example.py
changeset 0 a35731b5e31a
child 1 69318aba22bf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example.py	Wed Feb 16 23:51:30 2011 +0100
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import locale
+locale.setlocale(locale.LC_ALL, '')
+
+import os
+
+from tuikit.application import Application
+from tuikit.editfield import EditField
+from tuikit.window import Window
+from tuikit.button import Button
+from tuikit.scrollbar import VScrollbar
+from tuikit.textedit import TextEdit
+from tuikit.menubar import MenuBar
+from tuikit.menu import Menu
+from tuikit.layout import VerticalLayout
+
+
+class MyApplication(Application):
+    def __init__(self):
+        Application.__init__(self)
+        self.top.connect('keypress', self.globalkeypress)
+
+        menubar = MenuBar()
+        self.top.add(menubar)
+
+        filemenu = Menu(['New', '-', 'Open', 'Save', '-', 'Quit'])
+        self.top.add(filemenu)
+        filemenu.allowlayout = False
+        filemenu.hidden = True
+
+        editmenu = Menu(['Copy', 'Paste'])
+        self.top.add(editmenu)
+        editmenu.allowlayout = False
+        editmenu.hidden = True
+
+        helpmenu = Menu(['About'])
+        self.top.add(helpmenu)
+        helpmenu.allowlayout = False
+        helpmenu.hidden = True
+
+        menubar.setitems([
+            ('File', filemenu),
+            ('Edit', editmenu),
+            ('Help', helpmenu)
+            ])
+
+        vert = VerticalLayout()
+        self.top.layout(vert)
+
+
+        #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 globalkeypress(self, keyname, char):
+        if keyname == 'escape':
+            self.terminate()
+
+
+if __name__ == '__main__':
+    app = MyApplication()
+    app.start()
+