demo_editor.py
changeset 76 fa5301e58eca
parent 62 2f61931520c9
equal deleted inserted replaced
75:2430c643838a 76:fa5301e58eca
     5 locale.setlocale(locale.LC_ALL, '')
     5 locale.setlocale(locale.LC_ALL, '')
     6 
     6 
     7 import os
     7 import os
     8 
     8 
     9 from tuikit.application import Application
     9 from tuikit.application import Application
    10 from tuikit.textedit import TextEdit
    10 from tuikit.scrollview import ScrollView
       
    11 from tuikit.editbox import EditBox
    11 
    12 
    12 
    13 
    13 class MyApplication(Application):
    14 class MyApplication(Application):
    14     def __init__(self):
    15     def __init__(self):
    15         Application.__init__(self)
    16         Application.__init__(self)
    16         self.top.add_handler('keypress', self.on_top_keypress)
    17         self.top.add_handler('keypress', self.on_top_keypress)
    17 
    18 
    18         t = open('tuikit/widget.py').read()
    19         t = open('tuikit/widget.py').read()
    19         textedit = TextEdit(t)
    20         editbox = EditBox(t)
    20         self.top.add(textedit, halign='fill', valign='fill')
    21 
       
    22         scroll = ScrollView()
       
    23         scroll.add(editbox)
       
    24 
       
    25         self.top.add(scroll, halign='fill', valign='fill')
    21 
    26 
    22     def on_top_keypress(self, ev):
    27     def on_top_keypress(self, ev):
    23         if ev.keyname == 'escape':
    28         if ev.keyname == 'escape':
    24             self.terminate()
    29             self.terminate()
    25             return True
    30             return True