demos/03_application.py
changeset 109 105b1affc3c2
parent 97 0c2e0c09ba5c
child 111 b055add74b18
equal deleted inserted replaced
97:0c2e0c09ba5c 109:105b1affc3c2
     8 from tuikit.widgets.textfield import TextField
     8 from tuikit.widgets.textfield import TextField
     9 
     9 
    10 label = Label('Hello there!')
    10 label = Label('Hello there!')
    11 label.pos.update(20, 10)
    11 label.pos.update(20, 10)
    12 
    12 
    13 button = Button()
    13 button1 = Button()
    14 button.pos.update(20, 20)
    14 button1.pos.update(20, 20)
       
    15 button2 = Button()
       
    16 button2.pos.update(30, 20)
    15 
    17 
    16 field = TextField('text field')
    18 field = TextField('text field')
    17 field.pos.update(20, 30)
    19 field.pos.update(20, 30)
    18 
    20 
    19 app = Application()
    21 app = Application()
    20 app.root_window.add(label)
    22 app.root_window.add(label)
    21 app.root_window.add(button)
    23 app.root_window.add(button1)
       
    24 app.root_window.add(button2)
    22 app.root_window.add(field)
    25 app.root_window.add(field)
    23 app.root_window.focus_child = field
    26 app.root_window.focus_widget = field
       
    27 
       
    28 def on_keypress(keyname, char, mod):
       
    29     if keyname == 'escape':
       
    30         app.stop()
       
    31 
       
    32 app.window_manager.sig_keypress.connect(on_keypress)
       
    33 
    24 app.start()
    34 app.start()
       
    35