Hi. I'm new user in ubuntu and I like very much the glade interface designer.
I designed my first app and tryed to run it from python with this script:

#!/usr/bin/env python

import sys
import pygtk
import gtk
import gtk.glade

class MainWindow:
	""" This is the main window """
	def __init__(self):
		# Set the glade file
		self.gladefile = "GUI.glade"
		self.wTree = gtk.glade.XML(self.gladefile)
		# Get the main window
		self.window = self.wTree.get_widget("MainWindow")
		if (self.window):
			self.window.connect("destroy", gtk.main_quit)

if __name__ == "__main__":
	MainWindow = MainWindow()

When I run it from terminal there is no ouptput, but the frame never appears.
What is wrong with it?

I think there needs to be a self.window.show() in __init__ similar to the example below.

# very basic GTK/Python program showing just a window
# you have to install GTK runtime, PyCairo, PyGobject and PyGTK for this to work

import gtk

class Base(object):
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

    def main(self):

if __name__ == "__main__":
    base = Base()

Yes! that solved my problem! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.