You didn’t read my response carefully enough 
Its “wx.EmptyImage”
not “wx.wxEmptyImage”
The ‘import wx’ just means that you put a dot between the wx and the name. So “wxPanel” becomes "
wx.Panel"; and “wxWindow” becomes “wx.Window”… and “wxEmptyImage” becomes “wx.EmptyImage”
···
On 7/19/07, Nicholas Hansford nick.hansford@gmail.com wrote:
Yeah sorry, I was so exasperated when I left work today, I didn’t catch that it didn’t copy the wx.wxEmptyImage(…). And yes, I used the import wx way at the top of things. Thanks for the response though. Any other ideas?
It should have read:
import wx
…other code…
def pilToBitmap(self, pil):
return self.imageToBitmap(self.pilToImage(pil))
def pilToImage(self, pil):
wx.wxEmptyImage(pil.size[0], pil.size[1])
image.SetData(pil.convert('RGB').tostring())
return image
def imageToPil(self, image):
pil = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
pil.fromstring(image.GetData())
return pil
On 7/19/07, Stephen Hansen apt.shansen@gmail.com wrote:
Sorry, not use to this thing. I guess I should explain what I’m attempting. I need to be able to display an image inside of a window in wxpython. Easy enough I thought. Well after a long search on the internet, I found that this can be accomplished using a combination of python image library and wx. What follows is the source code:
def pilToBitmap(self, pil):
return self.imageToBitmap(self.pilToImage(pil))
def pilToImage(self, pil):
image.SetData(pil.convert('RGB').tostring())
return image
def imageToPil(self, image):
pil = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
pil.fromstring(image.GetData())
return pil
Obviously, I call piltoBitmap with the image I have. However, when the program encounters the wxEmptyImage(…) it says the module doesn’t exist. I was wondering if it was something I’d done wrong, or if it had been removed/renamed. Sorry for the confusions.
On 7/19/07, Nicholas Hansford <nick.hansford@gmail.com > > > wrote:
I don’t see what you’re talking about in the code above, however-- if it says “wxEmptyImage”, chances are you’re just using the Old API.
In the old days, you did:
“from wxPython import *” (or maybe “from wxPython.wx import *” – I can’t remember which)
Then stuff was accessed as “wxPanel” and “wxWindow”, with a wx prefix.
Now its been reorganized to be more pythonic and not require you pollute namespaces.
You just “import wx”, then “wx.Panel” and “wx.Window” – and in this case, “wx.EmptyImage”
Just put the dot in probably.
Yeah sorry, gmail stacked them up on me. And I swear when I looked it up online it had the extra wx. But I’ll try that tomorrow, thank you soooo muchk.
···
On 7/19/07, Stephen Hansen apt.shansen@gmail.com wrote:
You didn’t read my response carefully enough 
Its “wx.EmptyImage”
not “wx.wxEmptyImage”
The ‘import wx’ just means that you put a dot between the wx and the name. So “wxPanel” becomes "
wx.Panel"; and “wxWindow” becomes “wx.Window”… and “wxEmptyImage” becomes “wx.EmptyImage”
On 7/19/07, Nicholas Hansford nick.hansford@gmail.com wrote:
Yeah sorry, I was so exasperated when I left work today, I didn’t catch that it didn’t copy the wx.wxEmptyImage(…). And yes, I used the import wx way at the top of things. Thanks for the response though. Any other ideas?
It should have read:
import wx
…other code…
def pilToBitmap(self, pil):
return self.imageToBitmap(self.pilToImage(pil))
def pilToImage(self, pil):
wx.wxEmptyImage(pil.size[0], pil.size[1])
image.SetData(pil.convert('RGB').tostring())
return image
def imageToPil(self, image):
pil = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
pil.fromstring(image.GetData())
return pil
On 7/19/07, Stephen Hansen apt.shansen@gmail.com wrote:
Sorry, not use to this thing. I guess I should explain what I’m attempting. I need to be able to display an image inside of a window in wxpython. Easy enough I thought. Well after a long search on the internet, I found that this can be accomplished using a combination of python image library and wx. What follows is the source code:
def pilToBitmap(self, pil):
return self.imageToBitmap(self.pilToImage(pil))
def pilToImage(self, pil):
image.SetData(pil.convert('RGB').tostring())
return image
def imageToPil(self, image):
pil = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
pil.fromstring(image.GetData())
return pil
Obviously, I call piltoBitmap with the image I have. However, when the program encounters the wxEmptyImage(…) it says the module doesn’t exist. I was wondering if it was something I’d done wrong, or if it had been removed/renamed. Sorry for the confusions.
On 7/19/07, Nicholas Hansford <nick.hansford@gmail.com > > > > wrote:
I don’t see what you’re talking about in the code above, however-- if it says “wxEmptyImage”, chances are you’re just using the Old API.
In the old days, you did:
“from wxPython import *” (or maybe “from wxPython.wx import *” – I can’t remember which)
Then stuff was accessed as “wxPanel” and “wxWindow”, with a wx prefix.
Now its been reorganized to be more pythonic and not require you pollute namespaces.
You just “import wx”, then “wx.Panel” and “wx.Window” – and in this case, “wx.EmptyImage”
Just put the dot in probably.
–
Nicholas Hansford
nick.hansford@gmail.com
931 Community Dr.
Morgantown WV, 26505