im not sure if this is a wxpython question or just a python question but i need help. im using img2py to embed pictures into a .py script. my question is how do i get them out? i tried to call the image with this:
im not sure if this is a wxpython question or just a python question but i need help. im using img2py to embed pictures into a .py script. my question is how do i get them out? i tried to call the image with this:
dwpic = wx.Image(macroicons.getdwiconBitmap())
and this is the error i get:
TypeError: String or Unicode type required
If you look at your macroicons.py file you will see that there three functions defined for each image:
im trying to put it in a sizer and i get this error:
TypeError: wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item
A wx.Image instance is NOT a wx.Window. You need a control to show this image, e.g. a wx.StaticBitmap or a wx.BitmapButton etc.
What do you want to do with this image, what is it?
Werner
···
On 10/10/06, *Werner F. Bruhin* < werner.bruhin@free.fr > <mailto:werner.bruhin@free.fr>> wrote:
Hi Justin,
justin mcguire wrote:
> im not sure if this is a wxpython question or just a python
question
> but i need help. im using img2py to embed pictures into a .py
script.
> my question is how do i get them out? i tried to call the image
with
> this:
>
> dwpic = wx.Image(macroicons.getdwiconBitmap ())
>
> and this is the error i get:
>
> TypeError: String or Unicode type required
If you look at your macroicons.py file you will see that there three
functions defined for each image:
ya know your right i dont know what i was thinking, its a picture that i want to place on a panel that has a sizer, normally i would use a wx.Image() object and put where i want it in the ()
dwpic = wx.Image(basepanel))
but i cannot add the location into the () for this, is there a different way to add something to a panel?
Hi Justin,
justin mcguire wrote:
> im not sure if this is a wxpython question or just a python
question
> but i need help. im using img2py to embed pictures into a .py
script.
> my question is how do i get them out? i tried to call the image
with
> this:
>
> dwpic = wx.Image(macroicons.getdwiconBitmap ())
>
> and this is the error i get:
>
> TypeError: String or Unicode type required
If you look at your macroicons.py file you will see that there three
functions defined for each image:
E.g. in my file have an image called "bottle".
def getbottleBitmap():
return BitmapFromImage(getbottleImage())
ya know your right i dont know what i was thinking, its a picture that i want to place on a panel that has a sizer, normally i would use a wx.Image() object and put where i want it in the ()
dwpic = wx.Image(basepanel))
huh? I don't think you can do that at all.
but i cannot add the location into the () for this, is there a different way to add something to a panel?
If you just want the image, use:
dwpic = macroicons.getdwiconBitmap()
Sizer.Add(wx.StaticBitmap(dwpic)
A wx.Bitmap is a platform native version of a bitmap.
A wx.Image is a platform neutral 24bit RGB ini-memory version of an image.
Neither can be displayed directly, you need to put a Bitmap in a control of some sort:
wx.StaticBitmap
wx.BitmapButtton
or a custom class of some sort, derived from wx.,Window or wx,panel, in which you draw the Bitmap yourself with DCs.
ya know your right i dont know what i was thinking, its a picture that i
want to place on a panel that has a sizer, normally i would use a
wx.Image() object and put where i want it in the ()
dwpic = wx.Image(basepanel))
huh? I don’t think you can do that at all.
but i cannot add the location into the () for this, is there a different
way to add something to a panel?
If you just want the image, use:
dwpic = macroicons.getdwiconBitmap()
Sizer.Add(wx.StaticBitmap(dwpic)
A wx.Bitmap is a platform native version of a bitmap.
A wx.Image is a platform neutral 24bit RGB ini-memory version of an image.
Neither can be displayed directly, you need to put a Bitmap in a control
of some sort:
wx.StaticBitmap
wx.BitmapButtton
or a custom class of some sort, derived from wx.,Window or wx,panel, in