Menu, Status Bar, Tool Bar¶
Menu Editor¶
wxGlade includes a simple menu editor.
To attach a menu to a frame, go to Properties -> Widget and check Has MenuBar
.
This will add a menubar icon to the Tree window, just below the frame’s icon.
To open the menu editor, click the Edit menus...
button.
The following screenshots are from the file wxglade/examples/Allwidgets_28.wxg.
Example:
As an exercise, we will now add a “File” menu with two entries to our calculator window.
- When you hit
Edit menus...
for the first time, the bottom part of the editor window is almost empty. It will just contain a default entry “item”.- To create the required menu structure, change the label to “File”.
- To create the first item, hit “Add” and then the “>” button to turn it into a submenu item and then change the label to “Reset”. Give this item a name
i_reset
- Do the same again for an item “Exit”.
As of now, these items would not yet call any code when selected. So the “Event Handler” field needs to be filled with e.g. “on_menu_File_Reset” and “on_menu_File_Exit” for the two items.
When done and after hitting the “Start generating source files”, the editor and the created code should look like this:
You can implement the handler either in a derived class or directly in the file that wxGlade has written.
In the latter case, you should have enabled Application -> Keep user sources
.
- The example menu is part of the example at wxglade/examples/Calculator:
Status Bar Editor¶
To attach a status bar to a frame, go to Properties->Widget and check Has StatusBar
.
This will add a statusbar icon to the Tree window, just below the frame’s icon.
(Similar to Has MenuBar
in the first screenshot on this page.)
To add/remove fields to the status bar, go to Properties -> Widget -> Fields and use
the Add
/Insert
/Remove
/Apply
buttons.
If you set the size of a field to a negative value like -1
or -2
, it will grow to fill the available space.
Example:
Statusbar: Properties / Field Editor: two growing and two fixed size fields |
![]() |
Toolbar two growing and two fixed size fields |
![]() |
Tool Bar Editor¶
The logic for creating and editing a toolbar is the same as with menu bars.
Buttons and other controls are not supported yet