Thanks to both replies. Info from Dieter did the trick, the critical line was intcolumn.add_attribute(cell,'text',1).

I tried to set same trough use of gtk.TreeView.insert_column_with_attributes, which was ok for the columns with string, but failed when an integer was required. When that failed, my confusion went to a high level.

So basically, I am now one step closer to master the mysteries of TreeView and ListStore.

Regards

Olaf Devik


Den 2011-10-12 12:09, skrev Dieter Verfaillie:
On Wed, 12 Oct 2011 11:29:59 +0200, Olaf Devik wrote:
I am struggling with TreeView and CellRendererText.

I have a ListStore containing a number of fields with strings and
integers. The ListStore is connected to a TreeView and the string
fields render well as expected, but the fields with integers will not
render.

How can I render integer values in the TreeView?

Exactly like you would render a string value from your model. For
example, assuming field 1 in your model is of type int:

cell = gtk.CellRendererText()
intcolumn = gtk.TreeViewColumn('Amount')
intcolumn.pack_start(cell, True)
intcolumn.add_attribute(cell, 'text', 1)

A complete and working example is attached.

mvg,
Dieter
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to