On Sat, 22 Feb 2003 18:59:14 -0600, Lars Clausen <[EMAIL PROTECTED]> wrote:
> I'm trying to print out the selected area of a TreeView, but can't seem to
> get the contents out. I can't use gtk_tree_path_to_string, as pygtk has no
> treepath object, only a singleton tuple(!?). I can't use
> treemodel.get_iter_from_string, as that function doesn't seem to exist.
> Same goes for treemodel.get(). What's the easiest way to get the contents
> of a row given a model, a path and an iter?
You can use the TreeView.get_selection().get_selected() which returns the selected,iter
then you can use the get_value(iter,0) to get the value of the selected item.
Here is a snippet of some code I recently wrote:
def click_category(row):
global cat_model #previously defined tree model
global selected_category #previously defined text string
#determine the contents of the selected category row
selected,iter= row.get_selection().get_selected()
selected_category = cat_model.get_value(iter,0)
The above code is from my gonvert project at:
http://unihedron.com/projects/gonvert/gonvert.php
--
Anthony Tekatch
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/