]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/hook.py
SetPath() is now implemented in dirdlg.cpp
[wxWidgets.git] / wxPython / tests / hook.py
1 from wxPython.wx import *
2
3 class MyFrame(wxFrame):
4 def __init__(self, parent, id, title):
5 wxFrame.__init__(self, parent, id, title,
6 wxDefaultPosition, wxSize(400, 400))
7 self.panel = wxPanel(self, -1)
8 wxStaticText(self.panel, -1, "wxTextCtrl", wxPoint(5, 25),
9 wxSize(75, 20))
10 self.tc = wxTextCtrl(self.panel, 10, "", wxPoint(80, 25),
11 wxSize(200, 30))
12 EVT_CHAR_HOOK(self, self.OnCharHook)
13 #EVT_CHAR_HOOK(self.tc, self.OnCharHook)
14 EVT_CHAR(self, self.OnChar)
15 self.panel.Layout()
16 return
17
18 def OnCloseWindow(self, event):
19 self.Destroy()
20 return
21
22 def OnChar(self, event):
23 print "OnChar: %d '%c'" % (event.KeyCode(), chr(event.KeyCode()))
24 event.Skip()
25 return
26
27 def OnCharHook(self, event):
28 print "OnCharHook: %d" % event.KeyCode()
29 event.Skip()
30 return
31
32
33 class MyApp(wxApp):
34 def OnInit(self):
35 frame = MyFrame(None, -1, 'CharHook Test')
36 frame.Show(1)
37 self.SetTopWindow(frame)
38 return 1
39
40
41 app = MyApp(0)
42 app.MainLoop()
43
44
45