[pygtk] Sharing a CellRenderer among two or more columns

John Finlay finlay at moeraki.com
Sat Apr 19 12:18:58 WST 2008


Stéphane Brunet wrote:
> Hi,
>
> I am working on TreeViews using a ListStore model but I couldn't find 
> any answer on this yet:
>
> Say I have a ListStore with 4 columns containing strings. They are all 
> be rendered by a CellRendererText object in a separate TreeViewColumn. 
> I have tried to use a single instance of CellRendererText assigned to 
> each TreeViewColumn and it worked great.
>
> However, when I want to make each column editable, how do I specify 
> the callback function to the CellRendererText object so that it will 
> know in which column to put the new text ? Am I compelled to use a 
> separate instance of CellRendererText for each column ?
That's probably the only way - you have to determine which column from 
the cellrenderertext to set the right value in the liststore. With a 
single cellrenderetext you can't tell which column has been edited.

John


More information about the pygtk mailing list