demo_editor.py
changeset 62 2f61931520c9
parent 45 43b2279b06e1
child 76 fa5301e58eca
equal deleted inserted replaced
61:15088f62c4ac 62:2f61931520c9
     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.editfield import EditField
       
    11 from tuikit.textedit import TextEdit
    10 from tuikit.textedit import TextEdit
    12 
    11 
    13 
    12 
    14 class MyApplication(Application):
    13 class MyApplication(Application):
    15     def __init__(self):
    14     def __init__(self):
    16         Application.__init__(self)
    15         Application.__init__(self)
    17         self.top.add_handler('keypress', self.on_top_keypress)
    16         self.top.add_handler('keypress', self.on_top_keypress)
    18 
    17 
    19         #edit = EditField(50, 'DlouhyTest12')
       
    20         #self.top.add(edit)
       
    21 
       
    22         t = open('tuikit/widget.py').read()
    18         t = open('tuikit/widget.py').read()
    23         textedit = TextEdit(100, 40, t)
    19         textedit = TextEdit(t)
    24         self.top.add(textedit)
    20         self.top.add(textedit, halign='fill', valign='fill')
    25         textedit.x = 2
       
    26         self.textedit = textedit
       
    27 
    21 
    28     def on_top_keypress(self, ev):
    22     def on_top_keypress(self, ev):
    29         if ev.keyname == 'escape':
    23         if ev.keyname == 'escape':
    30             self.terminate()
    24             self.terminate()
    31             return True
    25             return True