Hey there... A very strange problem. I am designing an application to display the contents of a three dimensional data structure.( residing on server side )
It comprises of a dropdown ( combo box ) from which, the user selects the datatype and gets the objects as a list, which are displayed in a textview widget. those objects are themselves links to further information. The code for the callback of the combobox , which has the complete display function for the list in the viewbox is as follows. 1 def get_view_list(self, data = None): 2 data1 = view_list_combo.entry.get_text() 3 print data1 # user gets which datatype to query for 4 textbuffer.set_text("") 5 result = viewcalls.viewcallback(data1) # This is query for objects of that datatype , defined in some other file # list of names is obtained in the result file. 6 def hyperlink_handler(tag, widget, event, iter): 7 line_number = iter.get_line() 8 print(line_number) 9 if event.type == gtk.gdk.BUTTON_RELEASE: 10 print(result[line_number]) # Defn of event on tag "hyperlink" , for now, just on trial purpose displayin the # name of the object. Tag has been displayed outside the function. 11 hyperlink.connect('event', hyperlink_handler) 12 for text in result: 13 textbuffer.insert_at_cursor(text + '\n') # to insert text into the textbuffer 14 iter1 = textbuffer.get_start_iter() 15 iter = textbuffer.get_start_iter() 16 flag = iter.forward_to_line_end() 17 while(flag != 0) : 18 textbuffer.apply_tag(hyperlink,iter,iter1) 19 flag = iter.forward_line() 20 iter1 = iter.copy() 21 iter.forward_to_line_end() # to set hyperlink tag to each item and to detect the linenumber so as to pass it # to the function as itz same as position of the item in list. The Problem : i ll explain with an example when i select "metatype" from ComboBox, list of metatypes comes into variable - result (code line 5). and is also displayed on screen(Code line 12-13). now clicking on any one name (say -- animal on line 3 of text buffer) , displays that name since call prints result[3] ( code line 6 - 10 ) Now, however, after selecting somethign else from the combobox , say "ObjectType" , again, the list comes in result ( Code line 5 ) and is displayed on screen ( code line 12 - 13 ) . But When i click on any object ( say man, present on line 3 of buffer, ) not only the man ( result[3] ) is printed , but also animal ( which was at that position in the variable during prev iteration ) I dont know, why the values of result variable are not over written but are preserved everytime i call the event handler for the hyperlink. Do i have to manually clear them ?? how do i do that ?? I am stuck up at this point, since it doesnt record a unique name which i want to go ahead with the coding.. Can someone please help me out with this.. Thanks a million in anticipation.. -- Saurabh _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/