This is an unofficial mirror of Tkinter reference documentation (based on Python 2.7 and Tk 8.5) created by the late John Shipman.
It was last updated in 2013 and is unmaintained. [More info]
The methods shown here are available on all the ttk widgets.
.cget(option
)
This method returns the value for the specified
.
option
.configure(option
=value
, ...)
To set one or more widget options, use keyword
arguments of the form
. For example, to set a
widget's option
=value
font
, you might use an
argument such as “font=('serif',
12)
”.
If you provide no arguments, the method will return a
dictionary of all the widget's current option values. In
this dictionary, the keys will be the option names, and
each related value will be a tuple (
:
name
, dbName
,
dbClass
, default
, current
)
| The option name. |
| The database name of the option. |
| The database class of the option. |
| The default value of the option. |
| The current value of the option. |
.identify(x
,
y
)
Use this to determine what element is at a given
location within the widget. If the point (
relative to the widget is
somewhere within the widget, this method returns
the name of the element at that position; otherwise
it returns an empty string.
x
, y
)
.instate(stateSpec
,
callback=None, *args, **kw)
The purpose of this to determine whether the widget is in a specified state or combination of states.
If you provide a callable value as the callback
argument, and the widget matches
the state or combination of states specified by the
argument, that callable will be called with
positional arguments stateSpec
*args
and keyword
arguments **kw
. If the widget's state
does not match
, the stateSpec
callback
will not be called.
If you don't provide a callback
argument, the method will return True
if the widget's state matches
, stateSpec
False
otherwise.
For the structure of the
argument, see Section 46.1, “Specifying widget states in ttk”.
stateSpec
.state(stateSpec=None)
Use this item either to query a widget to determine its current states, or to set or clear one state.
If you provide a stateSpec
argument
of the form described in Section 46.1, “Specifying widget states in ttk”, the method will set or
clear states in the widget according to that
argument.
For example, for a widget w
, the
method w.state(['!disabled', 'selected'])
would clear the widget's 'disabled'
set and set its 'selected'
state.