Peter Mueller wrote:
Hi,Hi I attached a simple script and hope i coulded help you. Bye
-- The box said "Requires Win95, NT, or better," and so I installed Linux. ================================================internet : http://www.desys.de e-mail : [EMAIL PROTECTED] ================================================ |
#!/usr/bin/env python
#-*-Python-*-
import gtk
color1 = "green"
color2 = "red"
color3 = "blue"
class Test(gtk.GtkWindow):
def __init__(self):
gtk.GtkWindow.__init__(self)
self.set_usize(150, 100)
self.connect_after("delete_event", gtk.mainquit)
vbox = gtk.GtkVBox()
vbox.show()
self.add(vbox)
self.clist = gtk.GtkCList(3)
self.clist.column_titles_show(1)
for index in xrange(0, 3):
label = gtk.GtkLabel("label%d" % index)
label.show()
self.clist.set_column_widget(index, label)
self.clist.show()
vbox.pack_start(self.clist)
button = gtk.GtkButton("Quit")
button.connect("clicked", gtk.mainquit)
button.show()
vbox.pack_start(button, 0, 1, 0)
# First: copy the clist-style
self.style1 = self.clist.get_style().copy()
self.style2 = self.clist.get_style().copy()
self.style3 = self.clist.get_style().copy()
self.style1.base[gtk.STATE_NORMAL] = self.get_colormap().alloc(color1)
self.style2.base[gtk.STATE_NORMAL] = self.get_colormap().alloc(color2)
self.style3.base[gtk.STATE_NORMAL] = self.get_colormap().alloc(color3)
# Now fill the CList
self._fill_clist()
def _fill_clist(self):
self.clist.clear()
self.clist.freeze()
for lines in xrange(0, 3):
llist = []
for columns in xrange(6, 9):
llist.append("%d" % columns)
self.clist.append(llist)
# Now set the new style
self.clist.set_row_style(0, self.style1)
self.clist.set_row_style(1, self.style2)
self.clist.set_row_style(2, self.style3)
self.clist.thaw()
app = Test()
app.show()
gtk.mainloop()
