--- a/demo_input.py Wed Dec 26 01:00:31 2012 +0100
+++ b/demo_input.py Sat Dec 29 12:16:06 2012 +0100
@@ -10,7 +10,7 @@
class MyApplication(Application):
def __init__(self):
Application.__init__(self)
- self.top.connect('keypress', self.globalkeypress)
+ self.top.connect('keypress', self.on_top_keypress)
self.text = ''
textedit = TextEdit(100, 40, self.text)
@@ -19,10 +19,10 @@
self.textedit = textedit
- def globalkeypress(self, keyname, char):
- if char == 'q':
+ def on_top_keypress(self, ev):
+ if ev.char == 'q':
self.terminate()
- self.text += 'keyname: %s char: %s\n' % (keyname, char)
+ self.text += 'keyname: %(keyname)s char: %(char)s\n' % ev
self.textedit.settext(self.text)
self.textedit.scrolltoend()