]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/hook.py
1 from wxPython
.wx
import *
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),
10 self
.tc
= wxTextCtrl(self
.panel
, 10, "", wxPoint(80, 25),
12 EVT_CHAR_HOOK(self
, self
.OnCharHook
)
13 #EVT_CHAR_HOOK(self.tc, self.OnCharHook)
14 EVT_CHAR(self
, self
.OnChar
)
18 def OnCloseWindow(self
, event
):
22 def OnChar(self
, event
):
23 print "OnChar: %d '%c'" % (event
.KeyCode(), chr(event
.KeyCode()))
27 def OnCharHook(self
, event
):
28 print "OnCharHook: %d" % event
.KeyCode()
35 frame
= MyFrame(None, -1, 'CharHook Test')
37 self
.SetTopWindow(frame
)