demo_treeview.py
changeset 40 5faa38c10b67
parent 39 5e5deb1d3945
child 41 37b7dfc3eae6
equal deleted inserted replaced
39:5e5deb1d3945 40:5faa38c10b67
    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'])
    19         model.add(['a', 'd', 'e'], 'g')
    19         model.add(['a', 'd', 'e'], 'g')
    20         model.add('/a/d/f', 'h')
    20         model.add('/a/d/f', 'h')
    21 
    21 
       
    22         for i in range(100):
       
    23             model.add('/b', ['x'+str(i)])
       
    24 
    22         view = TreeView(model)
    25         view = TreeView(model)
    23         view.collapse('/a/d')
    26         #view.collapse('/a/d')
    24         self.top.add(view)
    27 
       
    28         scroll = ScrollView()
       
    29         scroll.add(view)
       
    30         self.top.add(scroll, expand=True, fill=True)
    25 
    31 
    26         vert = VerticalLayout()
    32         vert = VerticalLayout()
    27         self.top.layout(vert)
    33         self.top.layout(vert)
    28 
    34 
    29     def globalkeypress(self, keyname, char):
    35     def globalkeypress(self, eo, keyname, char):
    30         if keyname == 'escape':
    36         if keyname == 'escape':
    31             self.terminate()
    37             self.terminate()
    32 
    38 
    33 
    39 
    34 if __name__ == '__main__':
    40 if __name__ == '__main__':