1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import wx class Example(wx.Frame): def __init__( self , * args, * * kwargs): super (Example, self ).__init__( * args, * * kwargs) self .InitUI() def InitUI( self ): vbox = wx.BoxSizer(wx.VERTICAL) #create two horizontal toolbars toolbar1 = wx.ToolBar( self ) toolbar1.AddLabelTool(wx.ID_ANY, ' ', wx.Bitmap(' img / icon_shortcut_contacts.png')) toolbar1.AddLabelTool(wx.ID_ANY, ' ', wx.Bitmap(' img / icon_shortcut_looong.png')) toolbar1.AddLabelTool(wx.ID_ANY, ' ', wx.Bitmap(' img / icon_shortcut_sales.png')) toolbar1.Realize() toolbar2 = wx.ToolBar( self ) qtool = toolbar2.AddLabelTool(wx.ID_EXIT, ' ', wx.Bitmap(' img / icon_shortcut_tickets.png')) toolbar2.Realize() vbox.Add(toolbar1, 0 , wx.EXPAND) vbox.Add(toolbar2, 0 , wx.EXPAND) self .Bind(wx.EVT_TOOL, self .OnQuit, qtool) self .SetSizer(vbox) self .SetSize(( 300 , 250 )) self .SetTitle( 'Toolbars' ) self .Centre() self .Show( True ) def OnQuit( self , e): self .Close() def main(): ex = wx.App() Example( None ) ex.MainLoop() if __name__ = = '__main__' : main() |
article
Sunday, May 27, 2018
wxpython create more than one toolbars example
wxpython create more than one toolbars example