pythonpygtk

pygtk - how update a gtk.liststore?


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']).


Solution

  • 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')