Python and Glade: window not showing
Sven Arduwie
sven.arduwie at gmail.com
Sat May 30 11:02:29 EDT 2009
Can anyone help a python newbie and tell me why the simple window I
created in Glade is not showing?
This is the XML generated by Glade 3:
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="helloWorld">
<property name="visible">True</property>
<signal name="destroy" handler="on_helloWorld_destroy"/>
<child>
<placeholder/>
</child>
</object>
</interface>
And this is the Python code:
#!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gtk
class HelloWorld(object):
def getWindow(self):
return self.window
def setWindow(self, window):
self.window = window
window = property(getWindow, setWindow)
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("helloWorld.glade")
builder.connect_signals({"on_helloWorld_destroy" :
self.onHelloWorldDestroy})
self.window = builder.get_object("helloWorld")
self.window.show()
def onHelloWorldDestroy(self):
pass
I ran this in a terminal on Ubuntu 9.04 like this:
sven at Dell:~$ cd ./gvfs/python\ on\ sven/
sven at Dell:~/gvfs/python on sven$ python ./helloWorld.py
sven at Dell:~/gvfs/python on sven$
More information about the Python-list
mailing list