By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,097 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,097 IT Pros & Developers. It's quick & easy.

tkinter get widget option value

P: n/a
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

May 8 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
wrote in news:11**********************@y5g2000hsa.googlegro ups.com 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.
--
http://www.victim-prime.dsl.pipex.com/
May 8 '07 #2

P: n/a
On May 8, 2:15 pm, Rob Williscroft <r...@freenet.co.ukwrote:
wrote innews:11**********************@y5g2000hsa.googleg roups.comin
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.
--http://www.victim-prime.dsl.pipex.com/
Thanks Rob, that does it.

May 8 '07 #3

P: n/a
ra********@yahoo.com wrote:
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
May 9 '07 #4

P: n/a
On May 8, 6:51 pm, James Stroud <jstr...@mbi.ucla.eduwrote:
rahulna...@yahoo.com wrote:
Hi,
If I have abuttonwidget
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

Thanks! James

May 9 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.