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?
Probably a simple question with a simple answer, but I have so far not
found any simple solution. Most problems listed in the FAQs are far to
advanced compared to my simple problem.
Tips are welcome
Regards
Olaf Devik
_______________________________________________
pygtk mailing list py...@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
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
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
Ah yes, insert_column_with_attributes also works (and even
saves a bit of typing). See attachment :)
mvg,
Dieter