]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-02/toolbar.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-02 / toolbar.py
1 #!/usr/bin/env python
2
3 import wx
4 import images
5
6 class ToolbarFrame(wx.Frame):
7
8 def __init__(self, parent, id):
9 wx.Frame.__init__(self, parent, id, 'Toolbars',
10 size=(300, 200))
11 panel = wx.Panel(self)
12 panel.SetBackgroundColour('White')
13 statusBar = self.CreateStatusBar()
14 toolbar = self.CreateToolBar()
15 toolbar.AddSimpleTool(wx.NewId(), images.getNewBitmap(),
16 "New", "Long help for 'New'")
17 toolbar.Realize()
18 menuBar = wx.MenuBar()
19 menu1 = wx.Menu()
20 menuBar.Append(menu1, "&File")
21 menu2 = wx.Menu()
22 menu2.Append(wx.NewId(), "&Copy", "Copy in status bar")
23 menu2.Append(wx.NewId(), "C&ut", "")
24 menu2.Append(wx.NewId(), "Paste", "")
25 menu2.AppendSeparator()
26 menu2.Append(wx.NewId(), "&Options...", "Display Options")
27 menuBar.Append(menu2, "&Edit")
28 self.SetMenuBar(menuBar)
29
30 def OnCloseMe(self, event):
31 self.Close(True)
32
33 def OnCloseWindow(self, event):
34 self.Destroy()
35
36 if __name__ == '__main__':
37 app = wx.PySimpleApp()
38 frame = ToolbarFrame(parent=None, id=-1)
39 frame.Show()
40 app.MainLoop()
41