Hello all. The Toolbar documentation contains this statement:
the tools will always be made big enough to fit the size of the bitmaps used in them.
However in Windows that does not seem to be true. I have this test code:
import wx
class TestToolBar(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, 'Test ToolBar', size=(600, 400))
client = wx.Panel(self)
client.SetBackgroundColour(wx.WHITE)
tb = self.CreateToolBar( )
print("Default toolbar tool size: %s\n" % tb.GetToolBitmapSize())
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, (24,24))
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, (110,24))
tb.AddTool(10, "New", new_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "New", "Long help for 'New'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=10)
tb.AddTool(20, "Open", open_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Open", "Long help for 'Open'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=20)
tb.Realize()
def OnToolClick(self, event):
print("tool %s clicked\n" % event.GetId())
app = wx.App(False)
frm = TestToolBar(None)
frm.Show()
app.MainLoop()
In Linux I get the expected behavior, but in Windows the image is the default button size:
Any thoughts about how I can use different sized images for different buttons on Windows? Thanks.
Python 3.10, wxpython 4.2.0