demo_tableview.py
changeset 41 37b7dfc3eae6
parent 22 6ca8b2d221c3
child 42 0224ce40792f
--- a/demo_tableview.py	Wed Dec 26 01:00:31 2012 +0100
+++ b/demo_tableview.py	Sat Dec 29 12:16:06 2012 +0100
@@ -12,7 +12,7 @@
 class MyApplication(Application):
     def __init__(self):
         Application.__init__(self)
-        self.top.connect('keypress', self.globalkeypress)
+        self.top.connect('keypress', self.on_top_keypress)
 
         data = []
         for y in range(100):
@@ -21,19 +21,19 @@
                 row.append('r{}:c{}'.format(y, x))
             data.append(row)
         model = TableModel(data)
-        
+
         view = TableView(model)
         view.addcolumn(header=True, expand=False, sizereq=5)
         for x in range(10):
             view.addcolumn(title='head'+str(x))
-        
+
         self.top.add(view, expand=True, fill=True)
 
         vert = VerticalLayout()
         self.top.layout(vert)
 
-    def globalkeypress(self, keyname, char):
-        if keyname == 'escape':
+    def on_top_keypress(self, ev):
+        if ev.keyname == 'escape':
             self.terminate()