(PyGTK) Disabling ToolButton when no TreeView item is selected?

C

cypher543

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
 
S

Scripter47

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! :)

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

Hendrik van Rooyen

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?

you can try using the configure method on the toolbutton in the
command that is executed when the tree view is selected/deselected

- Hendrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top