[pygtk] setting row background color in treeview

Pakorn Chutinimitkul pakorn at themonkstudio.com
Wed Jun 27 15:52:13 WST 2007


	I'm in a process of porting my wxPython applications to PyGTK. I have a
problem with setting row background color in TreeView. After googling
for a while, I can't seem to find how to do that. I'm using TreeView in
conjunction with gtk.ListStore and gtk.CellRendererText. Here's the code:

class appGui:
    def __init__(self):
	gladefile = 'testlist.glade'
        self.wTree = gtk.glade.XML(gladefile,'window_userlist')
	self.listview = self.wTree.get_widget('treeview_user')
        self.listmodel = gtk.ListStore(str, str, str)
        renderer = gtk.CellRendererText()
        collist = [['Username',100],['Fullname',-1],['Group',-1]]
        i = 0
        for item in collist:
            column = gtk.TreeViewColumn(item[0],renderer,text=i)
            i += 1
	data = [
	['jjohn','Jack Johnson','Admin'],
	['acad','Adam Cadbury','User']
	for item in data:

Excuse my code, I'm a newbie to PyGTK. I want to set the background
color of user that's in Admin group to one color. I tried rules-hint,
but it's not what I'm looking for. It would be greatly appreciated if
anyone could share the resource or point me to the solution. Thank You!

Pakorn Chutinimitkul
The Monk Studio Company Limited
23/2 Soi Pattanakarn 17, Pattanakarn Rd.
Suanluang, Bangkok 10250, Thailand

More information about the pygtk mailing list