| pythonware.com | products ::: library ::: search ::: daily Python-URL! |
Basic Widget MethodsChapter 44. Basic Widget MethodsThe following methods are provided by all widgets (including the root window). In the method descriptions, self refer to the widget via which you reached the method. The root window and other Toplevel windows provide additional methods. See the Window Methods section for more information. Configurationconfigconfig(options...), configure(options...). Change one or more options for self. configconfig(), configure(). Return a dictionary containing the current settings for all widget options. For each option key, the value is either:
The latter case is used for aliases like bg (background) and bd (borderwidth). Note that the value fields aren't correctly formatted for some option types. cgetcget(option). Return the current value for the given option. Note that option values are always returned as strings. Use int and float where appropriate. keyskeys(). Return a tuple containing the options available for this widget. Note that the tuple currently includes option aliases (like bd, bg, and fg). Recommended approach:
for item in w.config():
if len(item) == 5:
option = item[0]
value = w.cget(option)
print(option, value)
|