[pygtk] Adding columns to a TextView, getting screen to redraw

John Pye john.pye at student.unsw.edu.au
Tue Sep 19 23:10:21 WST 2006


Hi all

A few months back (Feb) I got some advice from this list about
dynamically adding columns to a TreeView, as shown at the bottom of this
message.

Using a cell data function, I finally got around to implementing this in
the suggested way, so my TreeView is now using the object-in-a-tree-row
concept.

But now I am having a problem with the GUI updating of my TreeView. When
a value in the TreeView updates, the table doesn't immediately refresh.
If I mouse over, I get the refresh, but not if I just just sit still. I
found the 'queue_draw' function, but this doesn't seem to have any
effect either.

Any suggestions? What is it that actually triggers a row to redraw?

Possibly this is a bug that had been fixed? I am using PyGTK on Fedora
Core 4 at the moment, which is as follows:
$ rpm -q pygtk2
pygtk2-2.6.2-0.fc4.4

The code I'm working on is shown here:
https://pse.cheme.cmu.edu/svn-view/ascend/code/branches/extfn/pygtk/observer.py?rev=1046&view=markup

Cheers
JP

>On Wed, Feb 01, 2006 at 03:26:11AM +1100, John Pye wrote:
>
>  
>
>>> The issue appears to be that there is no way of adding columns to a
>>> *TreeStore* -- so I must copy the data from the existing TreeStore to a
>>> new one with an extra column, then re-set the model for the TreeView to
>>> the new TreeStore.
>>    
>>
>
>  
>
>>> Is there a better way? I imagine this could be slow in some cases where
>>> there is a lot of data.
>>    
>>
>
>Make your TreeStore have just one column of objects and use a cell data
>function for each treeview column.  Then you can dynamically add attributes
>for the new columns.  See
>
>http://pygtk.org/pygtk2tutorial/sec-CellRenderers.html#sec-CellDataFunction
>
>Dave Cook
>


More information about the pygtk mailing list