Difference between revisions of "PyGTK"
(Created page with "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. Use Glade to create t...") |
|||
| Line 1: | Line 1: | ||
| − | 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. | + | 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.<br> |
| + | Supposedly you should use the GtkBuilder file format over Libglade. With that in mind...<br> | ||
| + | {| class="wikitable" | ||
| + | ! scope="col" | Loading a glade file into a python program | ||
| + | |- | ||
| + | |<pre>import gtk | ||
| + | gladefile = 'app.glade' | ||
| + | builder = gtk.Builder() | ||
| + | builder.add_from_file(gladefile)</pre> | ||
| + | |} | ||
| − | + | ||
| + | But first you have to create the glade file. Create a window and divide it with boxes<br> | ||
| + | |||
| + | ==ComboBox== | ||
| + | {| class="wikitable" | ||
| + | ! scope="col" | glade side | ||
| + | ! scope="col" | 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 | ||
| + | | <pre> | ||
| + | |} | ||
Revision as of 00:54, 10 June 2013
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 |
|---|---|
|
|