iip  writes:
> Is anyone have experience creating dynamic liststore for browsing
> data? so I can add column or delete column in the list when the
> application run.

>From a bit of experimenting, this is what I found:

making a dynamic liststore like this most likely won't work. If you
make your own TreeModel (by inheriting from gtk.GenericTreeModel or
gtk.ListStore and overriding methods) you will need a on_get_n_columns
method, which should return the number of columns. However, this is
called only once (at least I couldn't make it get called again), so I
don't see any way to tell the treeview that the number of columns has
changed.

As a work-around you could create a new model with the required number
of columns, ad use TreeView.set_model() to make the TreeView display
that. (This switch will close all leafs you have opened in the tree,
but as you want a list, and not a tree, that won't affect you.)

Maybe you could avoid having to create treemodels all the time by
making an extensible treemodel you can add columns to(by subclassing
one of the existing ones) and telling the treeview that the treemodel
has changed with TreeView.set_model(model) (i.e. setting the model to
the existing one).

(Note that if you want to change what is displayed, you need to add a
column to the _treeview_, which can be done the same way as adding
columns when you create the treeview, and works fine.)

-- 
Abel Daniel
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to