wx.BitmapButton argument invalid

Hi,

I create a wx.BitmapButton with a wx.Bitmap (variable bmp). bmp is OK

btn=wx.BitmapButton.init(self,

aParent,

widget.makeNewId(aResource.id),

bmp,

pos=aResource.position,

size=size,

style=style,

name=aResource.name )

error: "TypeError: Control(): argument 3 has unexpected type ‘Bitmap’ "

argument 3 must be a Bitmap

btn=wx.BitmapButton.init(self,

aParent,

widget.makeNewId(aResource.id),

#bmp,

pos=aResource.position,

size=size,

style=style,

name=aResource.name )

no error and no image. btn is None

Ubuntu-trusty, 64 bits, python 3.42

Thanks for your help.

Philippe DALET

Remove "__init__" i.e. :

btn = wx.BitmapButton(aParent, wx.ID_ANY, yourBitmap)

Python/wxPython will call __init__ etc.

See doc here, especially the section "Possible Constructors"
http://wxpython.org/Phoenix/docs/html/BitmapButton.html?highlight=bitmapbutton#BitmapButton

Werner

···

On 11/16/2014 15:16, philippe DALET wrote:

Hi,
I create a wx.BitmapButton with a wx.Bitmap (variable bmp). bmp is OK

btn=wx.BitmapButton.__init__(self,
                                 aParent,
widget.makeNewId(aResource.id),
                                 bmp,
                                 pos=aResource.position,
                                 size=size,
                                 style=style,
                                 name=aResource.name )

error: "TypeError: Control(): argument 3 has unexpected type 'Bitmap' "
argument 3 must be a Bitmap

btn=wx.BitmapButton.__init__(self,
                                 aParent,
widget.makeNewId(aResource.id),
                                 #bmp,
                                 pos=aResource.position,
                                 size=size,
                                 style=style,
                                 name=aResource.name )

no error and no image. btn is None

Ubuntu-trusty, 64 bits, python 3.42

I know this solution. It works.

I have to use the method __init__.
All the widgets work fine, but not BitmapButton.

I have modified pythoncard for wxpython-phoenix and python3
Philippe.

I suspect a bug in

···

Le Sun, 16 Nov 2014 18:16:27 +0100, Werner <wernerfbd@gmx.ch> a écrit :

On 11/16/2014 15:16, philippe DALET wrote:
> Hi,
> I create a wx.BitmapButton with a wx.Bitmap (variable bmp). bmp is
> OK
>
> btn=wx.BitmapButton.__init__(self,
> aParent,
> widget.makeNewId(aResource.id),
> bmp,
> pos=aResource.position,
> size=size,
> style=style,
> name=aResource.name )
>
> error: "TypeError: Control(): argument 3 has unexpected type
> 'Bitmap' " argument 3 must be a Bitmap
>
> btn=wx.BitmapButton.__init__(self,
> aParent,
> widget.makeNewId(aResource.id),
> #bmp,
> pos=aResource.position,
> size=size,
> style=style,
> name=aResource.name )
>
> no error and no image. btn is None
>
> Ubuntu-trusty, 64 bits, python 3.42
>
Remove "__init__" i.e. :

btn = wx.BitmapButton(aParent, wx.ID_ANY, yourBitmap)

Python/wxPython will call __init__ etc.

See doc here, especially the section "Possible Constructors"
http://wxpython.org/Phoenix/docs/html/BitmapButton.html?highlight=bitmapbutton#BitmapButton

Werner

Hi Philippe,

...

I have to use the method __init__.
All the widgets work fine, but not BitmapButton.

I have modified pythoncard for wxpython-phoenix and python3
Philippe.

I suspect a bug in

Can you make a self contained sample which runs in 2.8/9 using the __init__ method?

http://wiki.wxpython.org/MakingSampleApps

Werner

···

On 11/17/2014 13:09, philippe dalet wrote:

Yes, PhythonCard uses __init__ method on wxpython 2.8/9. It runs.

Philippe.

···

Le Mon, 17 Nov 2014 14:00:15 +0100, Werner <wernerfbd@gmx.ch> a écrit :

Hi Philippe,

On 11/17/2014 13:09, philippe dalet wrote:
...
> I have to use the method __init__.
> All the widgets work fine, but not BitmapButton.
>
> I have modified pythoncard for wxpython-phoenix and python3
> Philippe.
>
> I suspect a bug in
Can you make a self contained sample which runs in 2.8/9 using the
__init__ method?

MakingSampleApps - wxPyWiki

Werner