]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python | |
2 | ||
3 | import wx | |
4 | from wx.py.shell import ShellFrame | |
5 | from wx.py.filling import FillingFrame | |
6 | import images | |
7 | ||
8 | class ToolbarFrame(wx.Frame): | |
9 | ||
10 | def __init__(self, parent, id): | |
11 | wx.Frame.__init__(self, parent, id, 'Toolbars', | |
12 | size=(300, 200)) | |
13 | panel = wx.Panel(self, -1) | |
14 | panel.SetBackgroundColour('White') | |
15 | statusBar = self.CreateStatusBar() | |
16 | toolbar = self.CreateToolBar() | |
17 | toolbar.AddSimpleTool(wx.NewId(), images.getNewBitmap(), | |
18 | "New", "Long help for 'New'") | |
19 | toolbar.Realize() | |
20 | menuBar = wx.MenuBar() | |
21 | menu1 = wx.Menu() | |
22 | menuBar.Append(menu1, "&File") | |
23 | menu2 = wx.Menu() | |
24 | menu2.Append(wx.NewId(), "&Copy", "Copy in status bar") | |
25 | menu2.Append(wx.NewId(), "C&ut", "") | |
26 | menu2.Append(wx.NewId(), "Paste", "") | |
27 | menu2.AppendSeparator() | |
28 | menu2.Append(wx.NewId(), "&Options...", "Display Options") | |
29 | menuBar.Append(menu2, "&Edit") | |
30 | ||
31 | menu3 = wx.Menu() | |
32 | shell = menu3.Append(-1, "&Python shell", | |
33 | "Open Python shell frame") | |
34 | filling = menu3.Append(-1, "&Namespace viewer", | |
35 | "Open namespace viewer frame") | |
36 | menuBar.Append(menu3, "&Debug") | |
37 | self.Bind(wx.EVT_MENU, self.OnShell, shell) | |
38 | self.Bind(wx.EVT_MENU, self.OnFilling, filling) | |
39 | ||
40 | self.SetMenuBar(menuBar) | |
41 | ||
42 | def OnCloseMe(self, event): | |
43 | self.Close(True) | |
44 | ||
45 | def OnCloseWindow(self, event): | |
46 | self.Destroy() | |
47 | ||
48 | def OnShell(self, event): | |
49 | frame = ShellFrame(parent=self) | |
50 | frame.Show() | |
51 | ||
52 | def OnFilling(self, event): | |
53 | frame = FillingFrame(parent=self) | |
54 | frame.Show() | |
55 | ||
56 | if __name__ == '__main__': | |
57 | app = wx.PySimpleApp() | |
58 | app.frame = ToolbarFrame(parent=None, id=-1) | |
59 | app.frame.Show() | |
60 | app.MainLoop() |