In my ongoing quest to learn python, I’m writing my first real GUI application since I was traumatized by dealt with swing and Java at university. Since I’m a GNOME user, I’ve gone with GTK. In the past day or two, I have learnt the following;

  • Use glade for designing your interfaces. Do not pass go, do not attempt to play with direct gtk calls directly, just use glade. It’s far less frustrating, and means you will have something that actually, you know, does something, sooner than later, thus keeping you interested and motivated.
  • When you dynamically generate a widget, such as another tab, it is imperative that you call show() on this widget, as the code snippet below illustrates.
tabs = self.wTree.get_widget('tabsholder') # tabsholder is the GtkNotebook
labelObject = gtk.Label("Tab text")
tabs.append_page(labelObject, gtk.Label("Label text"))
labelObject.show()

The last line is important, otherwise the code will run without error, but any changes configured will not show up. Alternatively you can call show_all() on the parent container to recursively call show() on all the child objects.