demo_window.py
changeset 62 2f61931520c9
parent 45 43b2279b06e1
child 74 23767a33a781
--- a/demo_window.py	Thu Jan 10 00:03:34 2013 +0100
+++ b/demo_window.py	Fri Jan 18 22:36:50 2013 +0100
@@ -8,28 +8,33 @@
 from tuikit.application import Application
 from tuikit.window import Window
 from tuikit.button import Button
+from tuikit import AnchorLayout
+from tuikit.common import Borders
 
 
 class MyApplication(Application):
     def __init__(self):
         Application.__init__(self)
+        self.top = AnchorLayout()
+        self.top.name = 'top'
         self.top.add_handler('keypress', self.on_top_keypress)
 
         #edit = EditField(50, 'DlouhyTest12')
         #self.top.add(edit)
 
         win = Window()
-        self.top.add(win)
+        win.title = 'demo_window'
+        win.resize(80, 25)
+        self.top.add(win, halign='left', valign='top')
 
         button = Button('click!')
-        win.add(button)
-        button.x = 10
-        button.y = 7
+#        win.add(button, x=10, y=6)
 
         button.add_handler('click', self.on_button_click)
         self.button = button
 
-        subwin = Window(8,8)
+        subwin = Window()
+        subwin.name = 'subwin'
         win.add(subwin)
 
 
@@ -48,9 +53,9 @@
     locale.setlocale(locale.LC_ALL, '')
     os.environ['ESCDELAY'] = '25' # do not wait 1 second after pressing Escape key
     app = MyApplication()
-    #app.start()
+    app.start()
 
-    cProfile.run('app.start()', 'demo_window.appstats')
-    p = pstats.Stats('demo_window.appstats')
-    p.sort_stats('time', 'cumulative').print_stats(20)
+    #cProfile.run('app.start()', 'demo_window.appstats')
+    #p = pstats.Stats('demo_window.appstats')
+    #p.sort_stats('time', 'cumulative').print_stats(20)