summaryrefslogtreecommitdiff
path: root/helloworld.py
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-07 21:01:31 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-07 22:00:29 +0000
commit45f7e04bb0f53223a5d05d93aa42b3faa6a97d76 (patch)
tree92e837e579092ffd55c0affb96a5f63d91a65ea8 /helloworld.py
testcases
Diffstat (limited to 'helloworld.py')
-rw-r--r--helloworld.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/helloworld.py b/helloworld.py
new file mode 100644
index 0000000..a810598
--- /dev/null
+++ b/helloworld.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+# This is the basic helloworld from PyGTK, with the GTK window decoration hint
+# set to false. The window manager should not draw any window decorations if
+# this is set.
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+class HelloWorld:
+
+ def delete_event(self, widget, event, data=None):
+ return False
+
+ def window_state_event(self, window, event):
+ print 'gtk.window.get_decorated(): ',
+ print str(self.window.get_decorated())
+
+ def destroy(self, widget, data=None):
+ gtk.main_quit()
+
+ def __init__(self):
+ self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+
+ # Decoration hint.
+ self.window.set_decorated(False)
+
+ self.window.connect("delete_event", self.delete_event)
+ self.window.connect("destroy", self.destroy)
+ self.window.connect('window-state-event', self.window_state_event)
+
+ self.label = gtk.Label("Maximize (Alt+F10) and unmaximize (Alt+F10) to reproduce " +
+ "the decoration error")
+
+ self.window.set_default_size(600, 100)
+
+ self.window.add(self.label)
+ self.label.show()
+ self.window.show()
+
+ def main(self):
+ gtk.main()
+
+if __name__ == "__main__":
+ hello = HelloWorld()
+ hello.main()