views:

731

answers:

2

I've got a wx.Toolbar and I'd like to make the buttons larger. I've searched and can't seem to find any concrete documentation on how to do this.

I'm also wondering how well this will translate across platforms; what will happen to the buttons and icons on OSX?

+1  A: 

Doesn't the size of the toolbar adapts itself automatically to the size of the bitmap icons? I think if you want a bigger toolbar, you need bigger bitmaps.

The software Task Coach is a 100% python app with different toolbar size. It is using wxPython, maybe you can find out how they achieved that?

Mapad
+2  A: 

It depends on what you want to change: is it the size of the buttons or the size of the icons ?

To change the size of the buttons, use SetToolBitmapSize (24x24 for instance):

toolbar.SetToolBitmapSize((24, 24))

This will only change the size of the buttons, though. If you want to change the size of the icons, simply use bigger ones. The easiest way is to use wx.ArtProvider:

wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, (24, 24))

So, summing it up:

# Define the size of the icons and buttons
iconSize = (24, 24)

# Set the size of the buttons
toolbar.SetToolBitmapSize(iconSize)

# Add some button
saveIcon = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, iconSize)
toolBar.AddSimpleTool(1, saveIcon, "Save", "Save current file")

Remark: As SetToolBitmapSize changes the size of the buttons, not the size of the icons, you can set the buttons to be larger than the icons. This should leave blank space around the icons.

Steph
I'll be using larger icons, but is it possible to make the buttons larger without increasing the icon bitmap size?
Soviut