diff -r 5faa38c10b67 -r 37b7dfc3eae6 demo_layout.py --- a/demo_layout.py Wed Dec 26 01:00:31 2012 +0100 +++ b/demo_layout.py Sat Dec 29 12:16:06 2012 +0100 @@ -10,13 +10,13 @@ class MyApplication(Application): def __init__(self): Application.__init__(self) - self.top.connect('keypress', self.globalkeypress) + self.top.connect('keypress', self.on_top_keypress) #self.top.borders = (1,1,1,1) vert = VerticalLayout(homogeneous=False) self.top.layout(vert) - + self.buildrow() self.buildrow(expand=True) self.buildrow(expand=True, fill=True) @@ -24,7 +24,7 @@ self.buildrow(homogeneous=True, fill=True) self.buildrow(homogeneous=True, fill=True, spacing=1) self.buildrow(homogeneous=True, fill=True, spacing=2) - + def buildrow(self, homogeneous=False, spacing=0, expand=False, fill=False): horz = HorizontalLayout(homogeneous=homogeneous, spacing=spacing) hbox1 = Container() @@ -34,9 +34,9 @@ for i in range(5): btn = Button('Btn' + str(i) * i * i) hbox1.add(btn, expand=expand, fill=fill) - - def globalkeypress(self, keyname, char): - if keyname == 'escape' or char == 'q': + + def on_top_keypress(self, ev): + if ev.keyname == 'escape' or ev.char == 'q': self.terminate()