demo_editor.py
changeset 34 e3beacd5e536
parent 19 5e78d52ebb24
child 41 37b7dfc3eae6
equal deleted inserted replaced
33:45f1b6d590bd 34:e3beacd5e536
    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.globalkeypress)
    20         self.top.connect('keypress', self.on_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 globalkeypress(self, keyname, char):
    51     def on_keypress(self, keyname, char):
    52         if keyname == 'escape':
    52         if keyname == 'escape':
    53             self.terminate()
    53             self.terminate()
    54         if keyname == 'f1':
    54         if keyname == 'f1':
    55             self.textedit.settext('%s' % self.top.focuschild)
    55             self.textedit.settext('%s' % self.top.focuschild)
    56             self.textedit.redraw()
    56             self.textedit.redraw()