demo_menu.py
changeset 45 43b2279b06e1
parent 42 0224ce40792f
child 63 2a0e04091898
equal deleted inserted replaced
44:d77f1ae3786c 45:43b2279b06e1
     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.on_top_keypress)
    13         self.top.add_handler('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()
    48             ('Help', helpmenu),
    48             ('Help', helpmenu),
    49             ])
    49             ])
    50 
    50 
    51         self.top.layout = VerticalLayout()
    51         self.top.layout = VerticalLayout()
    52 
    52 
    53 
       
    54         #button = Button('click!')
       
    55         #win.add(button)
       
    56         #button.x = 10
       
    57         #button.y = 7
       
    58 
       
    59         #button.connect('click', self.buttonclick)
       
    60         #self.button = button
       
    61 
       
    62         #subwin = Window(8,8)
       
    63         #win.add(subwin)
       
    64 
       
    65 
       
    66     def on_top_keypress(self, ev):
    53     def on_top_keypress(self, ev):
    67         if ev.keyname == 'escape':
    54         if ev.keyname == 'escape':
    68             self.terminate()
    55             self.terminate()
       
    56             return True
    69 
    57 
    70 
    58 
    71 if __name__ == '__main__':
    59 if __name__ == '__main__':
    72     app = MyApplication()
    60     app = MyApplication()
    73     app.start()
    61     app.start()