demos/04_texteditor.py
author Radek Brich <radek.brich@devl.cz>
Mon, 01 Sep 2014 08:45:51 +0200
changeset 104 742e504ec053
parent 96 68c562e0eb1f
child 106 abcadb7e2ef1
permissions -rwxr-xr-x
Update TextBox: Replace "spot" with "cursor".

#!/usr/bin/env python3

import demobase

from tuikit.core.application import Application
#from tuikit.scrollview import ScrollView
from tuikit.widgets.textbox import TextBox


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

        t = open('../tuikit/core/widget.py').read()
        editbox = TextBox(t)

        #scroll = ScrollView()
        #scroll.add(editbox)

        self.root_window.add(editbox)
        #self.root_window.add(scroll, halign='fill', valign='fill')

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


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