473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 4000
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Schmidt | last post by:
I'm trying to make a custom entry widget, as in the code that follows. There are two problems I'm trying to fix: 1) I would like the widget to behave as myEntry.Escape() does now, except that it...
11
by: Harlin Seritt | last post by:
There are certain options for Tkinter widgets that have default values that I don't much care for (borderwidth, font come to mind) and continuously change when I'm building interfaces. With a bit...
7
by: Harlin Seritt | last post by:
I was looking at the Tcl/Tk sourceforge page and found that there were a couple of new widgets being produced for Tcl 8.5. Does anyone know if there are any Tkinter wrappers somewhere? thanks, ...
2
by: Grooooops | last post by:
I've been hacking around this for a few days and have gotten close to what I want... but not quite... The TKinter Docs provide this example: # configure text tag text.tag_config("a",...
8
by: Dustan | last post by:
I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
8
by: Lie | last post by:
Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello...
0
by: Guilherme Polo | last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote: Come on.. "help on lines 384-403", that is not a good way to look for help. You are supposed to post some minimal code that...
1
by: Dude | last post by:
Hi All, I am fairly new to Python programming. I am working on a small Tkinter project and I think I am missing something, maybe you can help. The two lines below is all I have related to the...
4
by: Mudcat | last post by:
I've tried quite a few things to get this correct but have hit a couple of sticking points that I can't figure out. I need to ge the Text box to function like the 'wraplength' option in a Label. ...
0
by: Guilherme Polo | last post by:
On 10/29/08, Olrik Lenstra <o.lenstra@gmail.comwrote: It will be a combination of commands, not a single one. Initially I considered this as "probably without solution", since tcl acquired a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.