demos/20_texteditor.py
changeset 118 8c7970520632
parent 117 8680c2333546
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/20_texteditor.py	Sat Feb 21 12:01:57 2015 +0100
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+
+import sys
+
+from tuikit.core.application import Application
+#from tuikit.scrollview import ScrollView
+from tuikit.widgets.textbox import TextBox
+
+
+class MyApplication(Application):
+
+    def __init__(self):
+        Application.__init__(self)
+        self.window_manager.sig_keypress.connect(self.on_wm_keypress)
+        #self.top.add_handler('keypress', self.on_top_keypress)
+
+        t = open(sys.argv[0]).read()
+        editbox = TextBox(t)
+
+        #scroll = ScrollView()
+        #scroll.add(editbox)
+
+        self.root_window.add(editbox)
+        #self.root_window.add(scroll, halign='fill', valign='fill')
+
+    def on_wm_keypress(self, ev):
+        if ev.keyname == 'escape':
+            self.stop()
+            return True
+
+if __name__ == '__main__':
+    app = MyApplication()
+    app.start()
+