demo_treeview.py
changeset 45 43b2279b06e1
parent 42 0224ce40792f
child 62 2f61931520c9
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         model = TreeModel()
    15         model = TreeModel()
    16         model.add('/',  ['a', 'b'])
    16         model.add('/',  ['a', 'b'])
    17         model.add('/a', ['c', 'd'])
    17         model.add('/a', ['c', 'd'])
    18         model.add((0,1), ['e', 'f'])
    18         model.add((0,1), ['e', 'f'])
    32         self.top.layout = VerticalLayout()
    32         self.top.layout = VerticalLayout()
    33 
    33 
    34     def on_top_keypress(self, ev):
    34     def on_top_keypress(self, ev):
    35         if ev.keyname == 'escape':
    35         if ev.keyname == 'escape':
    36             self.terminate()
    36             self.terminate()
       
    37             return True
    37 
    38 
    38 
    39 
    39 if __name__ == '__main__':
    40 if __name__ == '__main__':
    40     app = MyApplication()
    41     app = MyApplication()
    41     app.start()
    42     app.start()