demo_colors.py
author Radek Brich <radek.brich@devl.cz>
Wed, 09 Jan 2013 22:32:15 +0100
changeset 60 fccca2a60492
parent 52 50a1857557da
child 62 2f61931520c9
permissions -rwxr-xr-x
DriverSDL: Implement blink attribute.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import locale
locale.setlocale(locale.LC_ALL, '')

from tuikit import Application, Window, Label, VerticalLayout


class MyApplication(Application):
    def __init__(self):
        Application.__init__(self)
        self.top.add_handler('keypress', self.on_top_keypress)

        win = Window()
        self.top.add(win)
        win.layout = VerticalLayout()

        for attr in ['blink', 'bold', 'standout', 'underline']:
            label = Label(attr)
            label.color = 'test-' + attr
            self.top.add(label)

        self.top.layout = VerticalLayout()

    def applytheme(self):
        Application.applytheme(self)
        self.driver.setcolor('test-blink',              'cyan on blue, blink')
        self.driver.setcolor('test-bold',               'cyan on blue, bold')
        self.driver.setcolor('test-standout',           'cyan on blue, standout')
        self.driver.setcolor('test-underline',          'cyan on blue, underline')

    def on_top_keypress(self, ev):
        if ev.keyname == 'escape':
            self.terminate()
            return True


if __name__ == '__main__':
    app = MyApplication()
    app.start()