Importing the .glade file

The .glade file is imported inside GladeTestApp's constructor. The code looks like this:

        self.glade_file = "pygladeui.glade"
        self.wTree=gtk.glade.XML(self.glade_file)

The first line defines a variable ( self.glade_file) and assigns it the file name of the .glade file, in this case pygladeui.glade.

The second line actually imports all user interface objects from the specified .glade file into a new variable named self.wTree.

Now, all the objects defined in the .glade file can be retrieved from self.wTreeand can be assigned local names for programmatic use. They are retrieved using the names they were given (or assigned by default) when using Glade, as shown next.