demos/04_texteditor.py
changeset 115 b4ff7392003a
parent 106 abcadb7e2ef1
child 117 8680c2333546
equal deleted inserted replaced
114:26c02bd94bd9 115:b4ff7392003a
     9 
     9 
    10 class MyApplication(Application):
    10 class MyApplication(Application):
    11 
    11 
    12     def __init__(self):
    12     def __init__(self):
    13         Application.__init__(self)
    13         Application.__init__(self)
       
    14         self.window_manager.sig_keypress.connect(self.on_wm_keypress)
    14         #self.top.add_handler('keypress', self.on_top_keypress)
    15         #self.top.add_handler('keypress', self.on_top_keypress)
    15 
    16 
    16         t = open('../tuikit/core/widget.py').read()
    17         t = open('../tuikit/core/widget.py').read()
    17         editbox = TextBox(t)
    18         editbox = TextBox(t)
    18 
    19 
    20         #scroll.add(editbox)
    21         #scroll.add(editbox)
    21 
    22 
    22         self.root_window.add(editbox)
    23         self.root_window.add(editbox)
    23         #self.root_window.add(scroll, halign='fill', valign='fill')
    24         #self.root_window.add(scroll, halign='fill', valign='fill')
    24 
    25 
    25     def on_top_keypress(self, ev):
    26     def on_wm_keypress(self, ev):
    26         if ev.keyname == 'escape':
    27         if ev.keyname == 'escape':
    27             self.terminate()
    28             self.stop()
    28             return True
    29             return True
    29 
    30 
    30 
    31 
    31 if __name__ == '__main__':
    32 if __name__ == '__main__':
    32     app = MyApplication()
    33     app = MyApplication()