demo_tableview.py
changeset 64 03f591f5fe5c
parent 45 43b2279b06e1
child 99 f3063f08ba81
equal deleted inserted replaced
63:2a0e04091898 64:03f591f5fe5c
     3 
     3 
     4 import locale
     4 import locale
     5 locale.setlocale(locale.LC_ALL, '')
     5 locale.setlocale(locale.LC_ALL, '')
     6 
     6 
     7 from tuikit import Application
     7 from tuikit import Application
     8 from tuikit.layout import VerticalLayout
       
     9 from tuikit.tableview import TableView, TableModel
     8 from tuikit.tableview import TableView, TableModel
    10 
     9 
    11 
    10 
    12 class MyApplication(Application):
    11 class MyApplication(Application):
    13     def __init__(self):
    12     def __init__(self):
    25         view = TableView(model)
    24         view = TableView(model)
    26         view.addcolumn(header=True, expand=False, sizereq=5)
    25         view.addcolumn(header=True, expand=False, sizereq=5)
    27         for x in range(10):
    26         for x in range(10):
    28             view.addcolumn(title='head'+str(x))
    27             view.addcolumn(title='head'+str(x))
    29 
    28 
    30         self.top.add(view, expand=True, fill=True)
    29         self.top.add(view, halign='fill', valign='fill')
    31 
       
    32         self.top.layout = VerticalLayout()
       
    33 
    30 
    34     def on_top_keypress(self, ev):
    31     def on_top_keypress(self, ev):
    35         if ev.keyname == 'escape':
    32         if ev.keyname == 'escape':
    36             self.terminate()
    33             self.terminate()
    37             return True
    34             return True