demo_colors.py
author Radek Brich <radek.brich@devl.cz>
Sat, 05 Jan 2013 16:47:30 +0100
changeset 49 1611c462c3e3
parent 46 2b43a7f38c34
child 52 50a1857557da
permissions -rwxr-xr-x
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.

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

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

from tuikit import Application, Label, VerticalLayout


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

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

        self.top.layout = VerticalLayout()

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


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