[pygtk] Adding progressbar into a liststore

John Finlay finlay at moeraki.com
Mon Nov 3 16:45:47 WST 2008


Timo wrote:
> Hello, I want to make some sort of downloadmanager like Firefox has, but 
> not that advanced. Just a window that adds a progressbar (and maybe a 
> label) for each download. But I already get stuck by adding a 
> progressbar into the liststore.
> This is what I have:
>
>   
You could use set_cell_data_func() to register a function that will 
provide the text data for display like:
>         liststore  = gtk.ListStore(object)
>         renderer = gtk.CellRendererText()
>         column   = gtk.TreeViewColumn("Downloads",renderer, text=0)
>   
def func(column, cell, model, iter, func_data):
       # create some text string to display
       cell.set_property('text', string)
       return

        column   = gtk.TreeViewColumn("Downloads",renderer)
        column.set_cell_data_func(renderer, func, func_data)

>         treeview.set_model(self.liststore)
>         treeview.append_column(column)
>
>         liststore.append([gtk.ProgressBar])
>
> Then I get this error:
>
>     Warning: unable to set property `text' of type `gchararray' from 
> value of type `PyObject'
>
> There is a row in the treeview, cause I can select one line, but nothing 
> is in it.
>   



More information about the pygtk mailing list