tkinter get widget option value

R

rahulnag22

Hi,
If I have a button widget

w = Button(root, text = "Button", state = 'disabled')

How can I get the value of option 'state' from the widget 'w'.
I want something like --

print w.state >> to print out >> 'disabled'

Thanks
Rahul
 
R

Rob Williscroft

wrote in in
comp.lang.python:
If I have a button widget

w = Button(root, text = "Button", state = 'disabled')

How can I get the value of option 'state' from the widget 'w'.
I want something like --

print w.state >> to print out >> 'disabled'

print w.cget( "state" )

Rob.
 
J

James Stroud

Hi,
If I have a button widget

w = Button(root, text = "Button", state = 'disabled')

How can I get the value of option 'state' from the widget 'w'.
I want something like --

print w.state >> to print out >> 'disabled'

Thanks
Rahul

print w["state"]

James
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top