treeview / pygtk problem

Tim Gerla tim at gerla.net
Thu Jul 10 15:57:59 EDT 2003


On Thu, 2003-07-10 at 11:53, Andre Lerche wrote:
> Hi list,
> 
> I am quite new to Python and try to learn Python with a small pygtk
> program. I am facing a problem which I am unable to solve for myself.
> I think I have read the documentation and some samples, but however
> I cannot find my mistake, so hopefully someone can help me with a
> short hint. This is a small sample application which demonstrates
> my problem:
> 
> import gtk as g
> import gobject
> 
> window = g.Window ()
> window.connect ('delete_event', g.mainquit)
> scrolledwin = g.ScrolledWindow ()
> renderer = g.CellRendererText ()
> col1 = g.TreeViewColumn ("col 1", renderer, text=1)
> col2 = g.TreeViewColumn ("col 2", renderer, text=1)
                                               ----^
That's your problem right there: text= expects a sequence from 0 to n.
So try:

col1 = g.TreeViewColumn ("col 1", renderer, text=0)
col2 = g.TreeViewColumn ("col 2", renderer, text=1)

That should solve your problem!  

-Tim
tim at gerla.net






More information about the Python-list mailing list