Tkinter and Widget

John McMonagle johnmc at
Thu Sep 13 01:21:00 CEST 2001

Try this:

from Tkinter import *
root = Tk()
b = Button(root, text='test')

This returns the following list of all the available options for the 
Button widget.

['activebackground', 'activeforeground', 'anchor', 'background', 'bd', 
'bg', 'bitmap', 'borderwidth', 'command', 'cursor', 'default', 
'disabledforeground', 'fg', 'font', 'foreground', 'height', 
'highlightbackground', 'highlightcolor', 'highlightthickness', 'image', 
'justify', 'padx', 'pady', 'relief', 'state', 'takefocus', 'text', 
'textvariable', 'underline', 'width', 'wraplength']

John McMonagle

Golem wrote:

> Hi all !
> I would like to know if there's a way to list all options that can be set
> for a widget ?
> In the Fredrik Lundh's Introduction To Tkinter, he says that we can use :
>      keys() => list of all options available for this widget
> I think that "keys" represent the widget (button, label)
> So i try :
> Mylist = Button()
> for i in Mylist
>       print i
> But it doesn't work
> How can we do that ?
> Thkx
> Golem

More information about the Python-list mailing list