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]
tabs option for
widgets gives you a number of ways to set tab stops
within the widget.
The default is to place tabs every eight characters.
To set specific tab stops, set this option to a
sequence of one or more distances. For example,
tabs=('3c', '5c', '12c') would
put tab stops 3, 5, and 12cm from the left side.
Past the last tab you set, tabs have the same width
as the distance between the last two existing tab
stops. So, continuing our example, because
12c-5c is 7 cm, if the user keeps pressing
the Tab key, the cursor would be
positioned at 19cm, 26cm, 33cm, and so on.
Normally, text after a tab character is aligned with
its left edge on the tab stop, but you can include
any of the keywords
tk.NUMERIC in the list after a distance, and
that will change the positioning of the text after
tk.LEFT tab stop has the default
tk.RIGHT tab stop will position the
text so its right edge is on the stop.
tk.CENTER tab will center the
following text on the tab stop.
tk.NUMERIC tab stop will place
following text to the left of the stop up until the
first period (
'.') in the
text—after that, the period will be centered on
the stop, and the rest of the text will positioned to
For example, setting
tk.RIGHT, '1.2i', tk.CENTER, '2i', tk.NUMERIC)
would set four tab stops: a left-aligned tab stop half an
inch from the left side, a right-aligned tab stop
0.8″ from the left side, a center-aligned tab stop
1.2″ from the left, and a numeric-aligned tab stop
2″ from the left.