demo_colors.py
changeset 62 2f61931520c9
parent 60 fccca2a60492
child 70 db2eab0beb45
equal deleted inserted replaced
61:15088f62c4ac 62:2f61931520c9
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     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, Window, Label, VerticalLayout
     7 from tuikit import Application, Window, Label, AnchorLayout, VerticalLayout
     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, top_layout=AnchorLayout)
    13         self.top.add_handler('keypress', self.on_top_keypress)
    13         self.top.add_handler('keypress', self.on_top_keypress)
    14 
    14 
    15         win = Window()
    15         win = Window(inner_layout=VerticalLayout)
    16         self.top.add(win)
    16         win.resize(30,10)
    17         win.layout = VerticalLayout()
    17         win.title = 'styles'
    18 
    18 
    19         for attr in ['blink', 'bold', 'standout', 'underline']:
    19         for attr in ['blink', 'bold', 'standout', 'underline']:
    20             label = Label(attr)
    20             label = Label(attr)
    21             label.color = 'test-' + attr
    21             label.color = 'test-' + attr
    22             self.top.add(label)
    22             win.add(label)
    23 
    23 
    24         self.top.layout = VerticalLayout()
    24         self.top.add(win)
    25 
    25 
    26     def applytheme(self):
    26     def apply_theme(self):
    27         Application.applytheme(self)
    27         Application.apply_theme(self)
    28         self.driver.setcolor('test-blink',              'cyan on blue, blink')
    28         self.driver.setcolor('test-blink',              'cyan on blue, blink')
    29         self.driver.setcolor('test-bold',               'cyan on blue, bold')
    29         self.driver.setcolor('test-bold',               'cyan on blue, bold')
    30         self.driver.setcolor('test-standout',           'cyan on blue, standout')
    30         self.driver.setcolor('test-standout',           'cyan on blue, standout')
    31         self.driver.setcolor('test-underline',          'cyan on blue, underline')
    31         self.driver.setcolor('test-underline',          'cyan on blue, underline')
    32 
    32