]>
Commit | Line | Data |
---|---|---|
be05b434 RD |
1 | #!/usr/bin/env python |
2 | ||
3 | import wx | |
4 | ||
5 | class RefactorExample(wx.Frame): | |
6 | ||
7 | def __init__(self, parent, id): | |
8 | wx.Frame.__init__(self, parent, id, 'Refactor Example', | |
9 | size=(340, 200)) | |
10 | panel = wx.Panel(self, -1) | |
11 | panel.SetBackgroundColour("White") | |
12 | prevButton = wx.Button(panel, -1, "<< PREV", pos=(80, 0)) | |
13 | self.Bind(wx.EVT_BUTTON, self.OnPrev, prevButton) | |
14 | nextButton = wx.Button(panel, -1, "NEXT >>", pos=(160, 0)) | |
15 | self.Bind(wx.EVT_BUTTON, self.OnNext, nextButton) | |
16 | self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) | |
17 | ||
18 | menuBar = wx.MenuBar() | |
19 | menu1 = wx.Menu() | |
20 | openMenuItem = menu1.Append(-1, "&Open", "Copy in status bar") | |
21 | self.Bind(wx.EVT_MENU, self.OnOpen, openMenuItem) | |
22 | quitMenuItem = menu1.Append(-1, "&Quit", "Quit") | |
23 | self.Bind(wx.EVT_MENU, self.OnCloseWindow, quitMenuItem) | |
24 | menuBar.Append(menu1, "&File") | |
25 | menu2 = wx.Menu() | |
26 | copyItem = menu2.Append(-1, "&Copy", "Copy") | |
27 | self.Bind(wx.EVT_MENU, self.OnCopy, copyItem) | |
28 | cutItem = menu2.Append(-1, "C&ut", "Cut") | |
29 | self.Bind(wx.EVT_MENU, self.OnCut, cutItem) | |
30 | pasteItem = menu2.Append(-1, "Paste", "Paste") | |
31 | self.Bind(wx.EVT_MENU, self.OnPaste, pasteItem) | |
32 | menuBar.Append(menu2, "&Edit") | |
33 | self.SetMenuBar(menuBar) | |
34 | ||
35 | static = wx.StaticText(panel, wx.NewId(), "First Name", | |
36 | pos=(10, 50)) | |
37 | static.SetBackgroundColour("White") | |
38 | text = wx.TextCtrl(panel, wx.NewId(), "", size=(100, -1), | |
39 | pos=(80, 50)) | |
40 | ||
41 | static2 = wx.StaticText(panel, wx.NewId(), "Last Name", | |
42 | pos=(10, 80)) | |
43 | static2.SetBackgroundColour("White") | |
44 | text2 = wx.TextCtrl(panel, wx.NewId(), "", size=(100, -1), | |
45 | pos=(80, 80)) | |
46 | ||
47 | firstButton = wx.Button(panel, -1, "FIRST") | |
48 | self.Bind(wx.EVT_BUTTON, self.OnFirst, firstButton) | |
49 | ||
50 | menu2.AppendSeparator() | |
51 | optItem = menu2.Append(-1, "&Options...", "Display Options") | |
52 | self.Bind(wx.EVT_MENU, self.OnOptions, optItem) | |
53 | ||
54 | lastButton = wx.Button(panel, -1, "LAST", pos=(240, 0)) | |
55 | self.Bind(wx.EVT_BUTTON, self.OnLast, lastButton) | |
56 | ||
57 | ||
58 | # Just grouping the empty event handlers together | |
59 | def OnPrev(self, event): pass | |
60 | def OnNext(self, event): pass | |
61 | def OnLast(self, event): pass | |
62 | def OnFirst(self, event): pass | |
63 | def OnOpen(self, event): pass | |
64 | def OnCopy(self, event): pass | |
65 | def OnCut(self, event): pass | |
66 | def OnPaste(self, event): pass | |
67 | def OnOptions(self, event): pass | |
68 | ||
69 | def OnCloseWindow(self, event): | |
70 | self.Destroy() | |
71 | ||
72 | if __name__ == '__main__': | |
73 | app = wx.PySimpleApp() | |
74 | frame = RefactorExample(parent=None, id=-1) | |
75 | frame.Show() | |
76 | app.MainLoop() | |
77 |