[Tutor] Problems with Treeview

John CORRY john.corry at ntlworld.com
Sat May 13 23:37:06 CEST 2006


Hi,
 
I am having problems selecting a row in treeview.  I am using
Pythoncard, Glade 2 and Python 2.4.
 
I am using the following code:-
 
combo3 = self.wTree.get_widget("treeview1")
model=gtk.TreeStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE
_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING,gobj
ect.TYPE_STRING,gobject.TYPE_STRING)
self.hostsmodel = model
combo3.set_model(model)
combo3.connect("row_activated", self.callback53, combo3,model)
 
 
def callback53(self,data,combo3,data2,data3,model):
        
        view = gtk.TreeView(model)
        selection = view.get_selection().get_selected()
        
        print selection
        
        result = model.get_value(iter,0)
        
        print result
 
I get the following error:
(<gtk.TreeStore object (GtkTreeStore) at 0xb3cb70>, None)
Traceback (most recent call last):
  File "C:\Documents and Settings\Johnc\Projects\project7\shopcall.py",
line 1
, in callback53
    result = model.get_value(iter,0)
TypeError: iter must be a GtkTreeIter
 
What do I need to assign to iter to make this code work?
 
Thanks,
 
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060513/66ba974a/attachment.htm 


More information about the Tutor mailing list