demo_colors.py
changeset 46 2b43a7f38c34
child 52 50a1857557da
equal deleted inserted replaced
45:43b2279b06e1 46:2b43a7f38c34
       
     1 #!/usr/bin/env python3
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 import locale
       
     5 locale.setlocale(locale.LC_ALL, '')
       
     6 
       
     7 from tuikit import Application, Label, VerticalLayout
       
     8 
       
     9 
       
    10 class MyApplication(Application):
       
    11     def __init__(self):
       
    12         Application.__init__(self)
       
    13         self.top.add_handler('keypress', self.on_top_keypress)
       
    14 
       
    15         for attr in ['blink', 'bold', 'dim', 'standout', 'underline']:
       
    16             label = Label(attr)
       
    17             label.color = 'test-' + attr
       
    18             self.top.add(label)
       
    19 
       
    20         self.top.layout = VerticalLayout()
       
    21 
       
    22     def on_top_keypress(self, ev):
       
    23         if ev.keyname == 'escape':
       
    24             self.terminate()
       
    25             return True
       
    26 
       
    27 
       
    28 if __name__ == '__main__':
       
    29     app = MyApplication()
       
    30     app.start()
       
    31