]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-05/badExample.py
5 class RefactorExample(wx
.Frame
):
7 def __init__(self
, parent
, id):
8 wx
.Frame
.__init
__(self
, parent
, id, 'Refactor Example',
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
)
18 menuBar
= wx
.MenuBar()
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")
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
)
35 static
= wx
.StaticText(panel
, wx
.NewId(), "First Name",
37 static
.SetBackgroundColour("White")
38 text
= wx
.TextCtrl(panel
, wx
.NewId(), "", size
=(100, -1),
41 static2
= wx
.StaticText(panel
, wx
.NewId(), "Last Name",
43 static2
.SetBackgroundColour("White")
44 text2
= wx
.TextCtrl(panel
, wx
.NewId(), "", size
=(100, -1),
47 firstButton
= wx
.Button(panel
, -1, "FIRST")
48 self
.Bind(wx
.EVT_BUTTON
, self
.OnFirst
, firstButton
)
50 menu2
.AppendSeparator()
51 optItem
= menu2
.Append(-1, "&Options...", "Display Options")
52 self
.Bind(wx
.EVT_MENU
, self
.OnOptions
, optItem
)
54 lastButton
= wx
.Button(panel
, -1, "LAST", pos
=(240, 0))
55 self
.Bind(wx
.EVT_BUTTON
, self
.OnLast
, lastButton
)
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
69 def OnCloseWindow(self
, event
):
72 if __name__
== '__main__':
73 app
= wx
.PySimpleApp()
74 frame
= RefactorExample(parent
=None, id=-1)