Isn't arg 4 the disabled bitmap? If you haven't one you can pass NullBitmap.
Werner
···
On 12/8/2015 11:43, steve wrote:
I have some set of png images, I'd like to use them as button icons in my toolbar (wx.ToolBar).
I do:
ID_DRAW_BUTTON = 100
self.toolbar = wx.ToolBar(self, -1, style=wx.TB_FLAT|wx.BORDER_RAISED)
draw_icon = wx.ArtProvider.GetBitmap("chart-icon", wx.ART_TOOLBAR, (16,16))
self.toolbar.AddTool(ID_DRAW_BUTTON, "Draw", draw_icon, shortHelpString="Draw Chart")
But it says
TypeError: in method 'ToolBarBase_DoAddTool', expected argument 4 of type 'wxBitmap const &'
although type of draw_icon is <class 'wx._gdi.Bitmap'>
So what should I do to use a png image as a toolbar button icon?
try this. wx3.0.2 call
wx.ToolBar.AddTool(self, id, bitmap=mybitmap, pushedBitmap=mybitmap, isToggle=0, clientData=None, shortHelpString=‘’, longHelpString=‘’)
It might differ a bit on older wxversions as far as arg placement or args.
···
On Tuesday, December 8, 2015 at 4:43:53 AM UTC-6, steve wrote:
I have some set of png images, I’d like to use them as button icons in my toolbar (wx.ToolBar).
I’m not sure the following is actually helpful. I have tried several methods (in the general use of the word not python method) of adding graphics (png,jpeg, icon, etc…) to toolbar panels. What I discovered was that in the end I needed a button. Once I started using buttons all worked well and as expected. Playing with the background and pic I got very good results. So try something like:
TypeError: in method ‘ToolBarBase_DoAddTool’, expected argument 4 of type ‘wxBitmap const &’
although type of draw_icon is <class ‘wx._gdi.Bitmap’>
So what should I do to use a png image as a toolbar button icon?
try this. wx3.0.2 call
wx.ToolBar.AddTool(self, id, bitmap=mybitmap, pushedBitmap=mybitmap, isToggle=0, clientData=None, shortHelpString=‘’, longHelpString=‘’)
It might differ a bit on older wxversions as far as arg placement or args.
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.