demo_menu.py
changeset 41 37b7dfc3eae6
parent 40 5faa38c10b67
child 42 0224ce40792f
equal deleted inserted replaced
40:5faa38c10b67 41:37b7dfc3eae6
     8 
     8 
     9 
     9 
    10 class MyApplication(Application):
    10 class MyApplication(Application):
    11     def __init__(self):
    11     def __init__(self):
    12         Application.__init__(self)
    12         Application.__init__(self)
    13         self.top.connect('keypress', self.globalkeypress)
    13         self.top.connect('keypress', self.on_top_keypress)
    14 
    14 
    15         menubar = MenuBar()
    15         menubar = MenuBar()
    16         self.top.add(menubar)
    16         self.top.add(menubar)
    17 
    17 
    18         helpwin = Window()
    18         helpwin = Window()
    62 
    62 
    63         #subwin = Window(8,8)
    63         #subwin = Window(8,8)
    64         #win.add(subwin)
    64         #win.add(subwin)
    65 
    65 
    66 
    66 
    67     def globalkeypress(self, keyname, char):
    67     def on_top_keypress(self, ev):
    68         if keyname == 'escape':
    68         if ev.keyname == 'escape':
    69             self.terminate()
    69             self.terminate()
    70 
    70 
    71 
    71 
    72 if __name__ == '__main__':
    72 if __name__ == '__main__':
    73     app = MyApplication()
    73     app = MyApplication()