summaryrefslogtreecommitdiff
path: root/helloworld.py
blob: a810598435d33778b4648616ccd26dbf081a969e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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()