[pygtk] gtk.CellRenderText.__setattr__

Matt Joiner anacrolix at gmail.com
Sun Jul 4 20:01:48 WST 2010


In what is analogous to a GtkTreeCellDataFunc callback, I'm calling
cell.text = blah on the CellRenderText being passed in. This has no
effect on what is seen in the attached TreeView, but checks to the
value of cell.text are returning previously set values. It's necessary
instead to call cell.set_property("text", blah), to have a visible
effect on the TreeView.

I took a look at the pygtk sources, but the binding generator language
used is unfamiliar. Is this behaviour expected? Should I be calling
set_property(), or am I incorrect in expecting __setattr__ to hook
this?

Here's some code snippets:

		peerview.insert_column_with_data_func(
				 -1, "Network Address", gtk.CellRendererText(),
				 self.peer_network_address_cell_data_func)

	def peer_network_address_cell_data_func(self, column, cell, model, iter):
		#pdb.set_trace()
		from urlparse import urlunsplit
		row = model[iter]
		text = urlunsplit((row[4], "{0}:{1}".format(row[1], row[2]), "", "", ""))
		print text
		cell.set_property("text", text)
		#cell.text =


More information about the pygtk mailing list