demo_window.py
changeset 19 5e78d52ebb24
child 28 feee783d4fc5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo_window.py	Fri Oct 07 12:02:33 2011 +0200
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import locale
+import os
+
+from tuikit.application import Application
+from tuikit.editfield import EditField
+from tuikit.window import Window
+from tuikit.button import Button
+
+
+class MyApplication(Application):
+    def __init__(self):
+        Application.__init__(self)
+        self.top.connect('keypress', self.globalkeypress)
+
+        #edit = EditField(50, 'DlouhyTest12')
+        #self.top.add(edit)
+
+        win = Window()
+        self.top.add(win)
+
+        button = Button('click!')
+        win.add(button)
+        button.x = 10
+        button.y = 7
+
+        button.connect('click', self.buttonclick)
+        self.button = button
+
+        subwin = Window(8,8)
+        win.add(subwin)
+
+
+    def buttonclick(self):
+        self.button.label = 'YES'
+
+
+    def globalkeypress(self, keyname, char):
+        if keyname == 'escape':
+            self.terminate()
+
+
+if __name__ == '__main__':
+    locale.setlocale(locale.LC_ALL, '')
+    os.environ['ESCDELAY'] = '25' # do not wait 1 second after pressing Escape key
+    app = MyApplication()
+    app.start()
+