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 foo = gtk.Label("Tab text") tabs.append_page(foo, gtk.Label("Label text")) foo.show()
That last line is really important, otherwise the code will run without error, but nothing will actually happen.