pygtk treview, ListStore not displaying properly

binaryjesus coolman.guron at gmail.com
Tue Jul 29 17:28:56 CEST 2008


finally i solved it. This for any googler who comes this way

	def show_sync_wind(self,obj, data = None):
		t = Template.select(Template.q.synced == '0')
		self.synclstore = gtk.ListStore(str,str,str,str,str)
		x = 0
		cr = gtk.CellRendererText()
		col = gtk.TreeViewColumn('#', cr);
		col.set_attributes(cr, text=0)#<------ attaches col to the 0`th item
of liststore
		col.set_expand(True)
		col.set_clickable(True)
		col.set_resizable(True)
		col.set_sort_column_id(0)
		self.tv.append_column(col)
		self.sno_col = col

		cr = gtk.CellRendererText()
		col = gtk.TreeViewColumn('Title', cr);
		col.set_attributes(cr, text=1)
		col.set_expand(True)
		col.set_clickable(True)
		col.set_resizable(True)
		col.set_sort_column_id(1)
		self.tv.append_column(col)
		self.title_col = col

		cr = gtk.CellRendererText()
		col = gtk.TreeViewColumn('Section', cr);
		col.set_attributes(cr, text=2)
		col.set_expand(True)
		col.set_clickable(True)
		col.set_resizable(True)
		col.set_sort_column_id(2)
		self.tv.append_column(col)
		self.section_col = col

		cr = gtk.CellRendererText()
		col = gtk.TreeViewColumn('Category', cr);
		col.set_attributes(cr, text=3)
		col.set_expand(True)
		col.set_clickable(True)
		col.set_resizable(True)
		col.set_sort_column_id(3)
		self.tv.append_column(col)
		self.category_col = col

		cr = gtk.CellRendererText()
		col = gtk.TreeViewColumn('Sync', cr);
		col.set_attributes(cr, text=4)
		col.set_expand(True)
		col.set_clickable(True)
		col.set_resizable(True)
		col.set_sort_column_id(4)
		self.tv.append_column(col)
		self.sync_col = col

		self.tv.set_model(self.synclstore)
		self.tv.set_headers_clickable(True)
		#self.tv.set_expander_column(self.title_col)
		for y in t:
			x = x+1
			row =
self.synclstore.append([str(x),y.title,y.section.name,y.category.name,y.synced])
		self.sync_window.show()



More information about the Python-list mailing list