demo_editor.py
changeset 41 37b7dfc3eae6
parent 34 e3beacd5e536
child 45 43b2279b06e1
equal deleted inserted replaced
40:5faa38c10b67 41:37b7dfc3eae6
    15 
    15 
    16 
    16 
    17 class MyApplication(Application):
    17 class MyApplication(Application):
    18     def __init__(self):
    18     def __init__(self):
    19         Application.__init__(self)
    19         Application.__init__(self)
    20         self.top.connect('keypress', self.on_keypress)
    20         self.top.connect('keypress', self.on_top_keypress)
    21 
    21 
    22         #edit = EditField(50, 'DlouhyTest12')
    22         #edit = EditField(50, 'DlouhyTest12')
    23         #self.top.add(edit)
    23         #self.top.add(edit)
    24 
    24 
    25 
    25 
    46 
    46 
    47     def buttonclick(self):
    47     def buttonclick(self):
    48         self.button.label = 'YES'
    48         self.button.label = 'YES'
    49 
    49 
    50 
    50 
    51     def on_keypress(self, keyname, char):
    51     def on_top_keypress(self, ev):
    52         if keyname == 'escape':
    52         if ev.keyname == 'escape':
    53             self.terminate()
    53             self.terminate()
    54         if keyname == 'f1':
       
    55             self.textedit.settext('%s' % self.top.focuschild)
       
    56             self.textedit.redraw()
       
    57             
       
    58 
    54 
    59 
    55 
    60 if __name__ == '__main__':
    56 if __name__ == '__main__':
    61     os.environ['ESCDELAY'] = '25' # do not wait 1 second after pressing Escape key
    57     os.environ['ESCDELAY'] = '25' # do not wait 1 second after pressing Escape key
    62     app = MyApplication()
    58     app = MyApplication()