tags:

views:

51

answers:

2

http://img824.imageshack.us/i/capturadetelag.png/

how update a gtk.liststore?

i mean get a random number every second on a column just like example, such as a download manager list, i'd like to have a simple example to know how this Liststore works for update the list, because i can't find a effective way to do something like a:

store.append(list1,list2,list3)

store.update(list3,['foobar']).

A: 

http://www.pygtk.org/pygtk2reference/class-gtkliststore.html

You need to use a gtk.TreeIter, also this has some good information.

If I were more familiar I could give you an example, I just remember that it's kind of a pain to use the gtk.liststore, but there's not really any better solution

Wayne Werner
+1  A: 

You can iterate over the rows in a list store (for row in liststore:...) as well as over the columns (values) in each row (for col_value in row:...).

For simple, direct updates:

row_n = 0
col_n = 2
liststore[row_n][col_n] = 'new value'

Otherwise, you can update using a gtk.TreeIter (row_iter):

liststore.set_value(row_iter, col_n, 'new value')
Walter