468,288 Members | 1,989 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,288 developers. It's quick & easy.

tkinter get widget option value

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
4 3584
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
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
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
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.

Similar topics

3 posts views Thread by Phil Schmidt | last post: by
11 posts views Thread by Harlin Seritt | last post: by
7 posts views Thread by Harlin Seritt | last post: by
2 posts views Thread by Grooooops | last post: by
8 posts views Thread by Dustan | last post: by
8 posts views Thread by Lie | last post: by
reply views Thread by Guilherme Polo | last post: by
1 post views Thread by Dude | last post: by
reply views Thread by Guilherme Polo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.