import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): toolbar = self.CreateToolBar() #call CreateToolBar() method qtool = toolbar.AddLabelTool(wx.ID_ANY, 'Quit', wx.Bitmap('img/close.jpg')) toolbar.Realize() self.Bind(wx.EVT_TOOL, self.OnQuit, qtool) #To handle toolbar events, use the wx.EVT_TOOL event binder self.SetSize((250, 200)) self.SetTitle('Simple toolbar') 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
Friday, May 27, 2016
wxpython simple Toolbars example
wxpython simple Toolbars example