SPAM-LOW: (PyGTK) Disabling ToolButton when no TreeView item is selected?

Scripter47 nospam at riddergarn.dk
Thu Dec 28 12:20:25 EST 2006


cypher543 skrev:
> I have a TreeView and a ToolButton. The ToolButton should only be
> active if the user has selected an item in the TreeView. What signal
> should I use to achieve this?
> 
> Thanks,
> David
> 
Hey

I use the "curselection()" function.

Example:
id = self.listbox.curselection()
id = id[0]
rf = self.listbox.get(id)
print id

It is on a listbox, but a think you also can use it on TreeViews.

Hope it helped! :)

-- 
   _________            .__        __                  ______________
  /   _____/ ___________|__|______/  |_  ___________  /  |  \______  \
  \_____  \_/ ___\_  __ \  \____ \   __\/ __ \_  __ \/   |  |_  /    /
  /        \  \___|  | \/  |  |_> >  | \  ___/|  | \/    ^   / /    /
/_______  /\___  >__|  |__|   __/|__|  \___  >__|  \____   | /____/
         \/     \/         |__|             \/           |__|




More information about the Python-list mailing list