demos/04_texteditor.py
changeset 96 68c562e0eb1f
parent 76 fa5301e58eca
child 106 abcadb7e2ef1
equal deleted inserted replaced
95:05392e369ede 96:68c562e0eb1f
       
     1 #!/usr/bin/env python3
       
     2 
       
     3 import demobase
       
     4 
       
     5 from tuikit.core.application import Application
       
     6 #from tuikit.scrollview import ScrollView
       
     7 from tuikit.widgets.textbox import TextBox
       
     8 
       
     9 
       
    10 class MyApplication(Application):
       
    11     def __init__(self):
       
    12         Application.__init__(self)
       
    13         #self.top.add_handler('keypress', self.on_top_keypress)
       
    14 
       
    15         t = open('../tuikit/core/widget.py').read()
       
    16         editbox = TextBox(t)
       
    17 
       
    18         #scroll = ScrollView()
       
    19         #scroll.add(editbox)
       
    20 
       
    21         self.root_window.add(editbox)
       
    22         #self.root_window.add(scroll, halign='fill', valign='fill')
       
    23 
       
    24     def on_top_keypress(self, ev):
       
    25         if ev.keyname == 'escape':
       
    26             self.terminate()
       
    27             return True
       
    28 
       
    29 
       
    30 if __name__ == '__main__':
       
    31     app = MyApplication()
       
    32     app.start()
       
    33