[pygtk] Help with a newbie question!

Cristian Prieto cprieto at info-servicios.net
Sun Aug 15 07:10:47 WST 2004


Hello, this could be a very newbie question but I've already read the
PyGTK tutorial and the PyGTK reference and I couldn't get the answer...

First at all, I'm developing an app using pygtk, the app will extract
all the info from a database, it will show a list of items to the user,
the user will choose the appropiates items and click in the Accept
button, I will get only the checked items from the list... It sounds so
easy, but when I implement the solution using PyGTK I have some
troubles...

I use a ListStore to show the items, the first column is a gobject.
TYPE_BOOLEAN and the first renderer is a gtk.CellRendererToggle...

consider the following example (very similar to my code):

     1. renderertoggle = gtk.CellRenderToggle()
     2. renderertext = gtk.CellRendererText()
     3. 
     4. itemlist = [[False, 'Item name 1'], [False, 'Item name2']]
     5. model = gtk.ListStore(bool, str)
     6. column = gtk.TreeViewColumn('Check', renderertoggle)
     7. theTreeView.append_column(column)
     8. column = gtk.TreeViewColumn('String', renderertext, text=1)
     9. 
    10. for item in itemlist :
    11.         model.append(item)

The model is shown but I couldn't check any of the items in the list...
(the toggle button is not working!), how could I get my finish with it?
(I guess I will need then to retrive the data from the list, how could I
get it?)

I really appreciate your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20040814/cbbd1fc9/attachment.html


More information about the pygtk mailing list