demo_checkbox.py
changeset 30 05500124d7fb
child 34 e3beacd5e536
equal deleted inserted replaced
29:c0cdef06fd16 30:05500124d7fb
       
     1 #!/usr/bin/env python3
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 import locale
       
     5 locale.setlocale(locale.LC_ALL, '')
       
     6 
       
     7 from tuikit import *
       
     8 
       
     9 
       
    10 class MyApplication(Application):
       
    11     def __init__(self):
       
    12         Application.__init__(self)
       
    13         self.top.connect('keypress', self.globalkeypress)
       
    14 
       
    15         vert = VerticalLayout(homogeneous=False)
       
    16         self.top.layout(vert)
       
    17         
       
    18         combo = ComboBox(items=['abc', 'xyz'])
       
    19         self.top.add(combo)
       
    20         
       
    21         for i in range(10):
       
    22             cbox = Checkbox('checkbox ' + str(i))
       
    23             self.top.add(cbox)
       
    24         
       
    25     def globalkeypress(self, keyname, char):
       
    26         if keyname == 'escape' or char == 'q':
       
    27             self.terminate()
       
    28 
       
    29 
       
    30 if __name__ == '__main__':
       
    31     app = MyApplication()
       
    32     app.start()
       
    33