PyGTK

From Projects Wiki
Revision as of 00:54, 10 June 2013 by Dogtaton (talk | contribs)
Jump to: navigation, search

PyGTK is loads better than TKinter. There are far more events to work with which let you make a more responsive, convenient, and concise interface.
Supposedly you should use the GtkBuilder file format over Libglade. With that in mind...

Loading a glade file into a python program
import gtk
gladefile = 'app.glade'
builder = gtk.Builder()
builder.add_from_file(gladefile)


But first you have to create the glade file. Create a window and divide it with boxes

ComboBox

glade side adding items, pygtk side
  • Create a ListStore for the model
    • Add a column to the ListStore on the General tab. gchararray for strings
  • Create a ComboBox
    • Set the model to the ListStore
    • Right click the ComboBox in the widget tree and click Edit
      • On the Hierarchy tab, click add. Name it whatever.
      • Set the Text property to the column you want displayed from the ListStore