tuikit/label.py
author Radek Brich <radek.brich@devl.cz>
Wed, 03 Sep 2014 19:13:37 +0200
changeset 110 cf3d49cdd6e2
parent 62 2f61931520c9
permissions -rw-r--r--
Add cursesw driver, using curses get_wch() for unicode input. It alse has enabled keypad() to let curses interpret control keys and mouse input.

# -*- coding: utf-8 -*-

from tuikit.widget import Widget


class Label(Widget):
    def __init__(self, label=''):
        Widget.__init__(self)
        self._default_size.update(len(label), 1)
        self.label = label
        self.color = 'normal'

    def on_draw(self, ev):
        ev.driver.pushcolor(self.color)
        ev.driver.puts(ev.x, ev.y, self.label)
        ev.driver.popcolor()