demo_colors.py
changeset 52 50a1857557da
parent 46 2b43a7f38c34
child 60 fccca2a60492
equal deleted inserted replaced
51:dce7325109c1 52:50a1857557da
    10 class MyApplication(Application):
    10 class MyApplication(Application):
    11     def __init__(self):
    11     def __init__(self):
    12         Application.__init__(self)
    12         Application.__init__(self)
    13         self.top.add_handler('keypress', self.on_top_keypress)
    13         self.top.add_handler('keypress', self.on_top_keypress)
    14 
    14 
    15         for attr in ['blink', 'bold', 'dim', 'standout', 'underline']:
    15         for attr in ['blink', 'bold', 'standout', 'underline']:
    16             label = Label(attr)
    16             label = Label(attr)
    17             label.color = 'test-' + attr
    17             label.color = 'test-' + attr
    18             self.top.add(label)
    18             self.top.add(label)
    19 
    19 
    20         self.top.layout = VerticalLayout()
    20         self.top.layout = VerticalLayout()
       
    21 
       
    22     def applytheme(self):
       
    23         Application.applytheme(self)
       
    24         self.driver.setcolor('test-blink',              'cyan on blue, blink')
       
    25         self.driver.setcolor('test-bold',               'cyan on blue, bold')
       
    26         self.driver.setcolor('test-standout',           'cyan on blue, standout')
       
    27         self.driver.setcolor('test-underline',          'cyan on blue, underline')
    21 
    28 
    22     def on_top_keypress(self, ev):
    29     def on_top_keypress(self, ev):
    23         if ev.keyname == 'escape':
    30         if ev.keyname == 'escape':
    24             self.terminate()
    31             self.terminate()
    25             return True
    32             return True