@@ -769,34 +769,76 @@ Tk option data types
769769
770770Many widget options documented in the reference
771771accept values of a small number of common types, described here.
772+ The standard options and their types are described in the
773+ :manpage: `options(3tk)` manual page.
772774
773775anchor
774776 Legal values are points of the compass: ``"n" ``, ``"ne" ``, ``"e" ``, ``"se" ``,
775777 ``"s" ``, ``"sw" ``, ``"w" ``, ``"nw" ``, and also ``"center" ``.
778+ The *labelanchor * option of :class: `LabelFrame ` and
779+ :class: `ttk.LabelFrame <tkinter.ttk.LabelFrame> `
780+ accepts also ``"en" ``, ``"es" ``, ``"wn" `` and ``"ws" ``.
781+ The *sticky * option of the grid geometry manager accepts a combination
782+ of the compass directions, such as ``"nsew" ``, or an empty string.
776783
777784bitmap
778785 There are ten built-in, named bitmaps: ``'error' ``, ``'gray12' ``,
779786 ``'gray25' ``, ``'gray50' ``, ``'gray75' ``, ``'hourglass' ``, ``'info' ``,
780- ``'questhead' ``, ``'question' ``, ``'warning' ``. To specify an X bitmap
781- filename, give the full path to the file, preceded with an ``@ ``, as in
782- ``"@/usr/contrib/bitmap/gumby.bit" ``.
787+ ``'questhead' ``, ``'question' ``, ``'warning' ``.
788+ On macOS the following bitmaps are available as well:
789+ ``'application' ``, ``'accessory' ``, ``'folder' ``, ``'pfolder' ``,
790+ ``'trash' ``, ``'floppy' ``, ``'ramdisk' ``, ``'cdrom' ``, ``'preferences' ``,
791+ ``'querydoc' ``, ``'stop' ``, ``'note' `` and ``'caution' ``.
792+ To specify an X bitmap file, give the full path to the file,
793+ preceded with an ``@ ``, as in ``"@/usr/contrib/bitmap/gumby.bit" ``.
783794
784795boolean
785- You can pass integers 0 or 1 or the strings ``"yes" `` or ``"no" ``.
796+ You can pass the integers 0 or 1, ``True `` or ``False ``, or the strings
797+ ``"0" ``, ``"1" ``, ``"yes" ``, ``"no" ``, ``"true" ``, ``"false" ``, ``"on" ``
798+ or ``"off" ``.
799+ The strings are matched ignoring case,
800+ and an unambiguous prefix, such as ``"t" ``, is enough.
801+ Any non-zero integer means true.
786802
787803callback
788- This is any Python function that takes no arguments. For example::
804+ This is any callable object.
805+ Most callbacks take no arguments. For example::
789806
790807 def print_it():
791808 print("hi there")
792809 fred["command"] = print_it
793810
811+ Some options call it with arguments,
812+ such as the *command * option of :class: `Scale `,
813+ which is called with the new value.
814+
794815color
795- Colors can be given as the names of X colors in the rgb.txt file, or as strings
796- representing RGB values in 4 bit: ``"#RGB" ``, 8 bit: ``"#RRGGBB" ``, 12 bit:
797- ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" `` ranges, where R,G,B here
798- represent any legal hex digit. See the :manpage: `colors(3tk)` man page for
799- the list of named colors.
816+ Colors can be given as symbolic names, such as ``"red" `` or ``"light blue" ``,
817+ or as strings representing RGB values in 4 bit: ``"#RGB" ``, 8 bit:
818+ ``"#RRGGBB" ``, 12 bit: ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" ``
819+ ranges, where R,G,B here represent any legal hex digit.
820+ Tk provides a portable set of symbolic names available on all platforms;
821+ they are matched ignoring case and spaces,
822+ so ``"light blue" ``, ``"Light Blue" `` and ``"lightblue" ``
823+ are the same color.
824+ The full list of names, including the platform-specific names
825+ of the current system colors
826+ (for example ``"systemButtonFace" `` on Windows
827+ or ``"systemWindowBody" `` on macOS),
828+ is given in the :manpage: `colors(3tk)` manual page.
829+ :meth: `~tkinter.Misc.winfo_rgb ` returns
830+ the red, green and blue components of a color.
831+
832+ compound
833+ Determines how to combine an image and a text displayed in a widget.
834+ Legal values are ``"none" `` (display the image if there is one,
835+ otherwise the text), ``"text" ``, ``"image" ``,
836+ ``"center" `` (display the text in the center of the image) and
837+ ``"top" ``, ``"bottom" ``, ``"left" ``, ``"right" ``
838+ (display the image above, below, to the left of or to the right
839+ of the text).
840+ The themed widgets accept all these values,
841+ the classic widgets accept all except ``"text" `` and ``"image" ``.
800842
801843cursor
802844 The name of the mouse cursor to display while the pointer is over the widget.
@@ -823,19 +865,32 @@ font
823865 ``(family, size, *styles) `` (or as the equivalent string
824866 ``"Courier 10 bold" ``). Font sizes with positive numbers are measured in
825867 points; sizes with negative numbers are measured in pixels.
826-
827- geometry
828- This is a string of the form ``widthxheight ``, where width and height are
829- measured in pixels for most widgets (in characters for widgets displaying text).
830- For example: ``fred["geometry"] = "200x100" ``.
868+ The name of a named font, such as ``"TkDefaultFont" ``,
869+ a :class: `tkinter.font.Font ` instance,
870+ or, on X11, an XLFD font name can be used as well.
831871
832872justify
833873 Legal values are the strings: ``"left" ``, ``"center" ``, and ``"right" ``.
834874
875+ orient
876+ Legal values are ``"horizontal" `` and ``"vertical" ``.
877+
878+ padding
879+ This is a legal distance (see above), applied on all sides,
880+ or a sequence of up to four distances
881+ specifying the left, top, right and bottom padding.
882+ If fewer than four are specified,
883+ the bottom padding defaults to the top one,
884+ the right one to the left one, and the top one to the left one.
885+ It is only supported by the themed widgets.
886+
835887region
836- This is a string with four space-delimited elements, each of which is a legal
837- distance (see above). For example: ``"2 3 4 5" `` and ``"3i 2i 4.5i 2i" `` and
838- ``"3c 2c 4c 10.43c" `` are all legal regions.
888+ Used for the *scrollregion * option of :class: `Canvas `.
889+ This is a string with four space-delimited elements,
890+ each of which is a legal distance (see above),
891+ or a sequence of four such elements.
892+ For example: ``"2 3 4 5" ``, ``(2, 3, 4, 5) ``, ``"3i 2i 4.5i 2i" `` and
893+ ``"3c 2c 4c 10.43c" `` are all legal regions.
839894
840895relief
841896 Determines what the border style of a widget will be. Legal values are:
@@ -846,8 +901,19 @@ scrollcommand
846901 This is almost always the :meth: `!set ` method of some scrollbar widget, but can
847902 be any widget method that takes a single argument.
848903
904+ state
905+ Legal values are ``"normal" ``, ``"disabled" `` and, depending on the widget,
906+ also ``"active" ``, ``"hidden" `` (for :class: `Canvas ` items)
907+ or ``"readonly" `` (for :class: `Entry `, :class: `Spinbox `
908+ and the themed widgets).
909+ The themed widgets have in addition a more general set of states,
910+ which is manipulated with
911+ :meth: `ttk.Widget.state <tkinter.ttk.Widget.state> `.
912+
849913wrap
850- Must be one of: ``"none" ``, ``"char" ``, or ``"word" ``.
914+ Must be one of ``"none" ``, ``"char" `` or ``"word" ``
915+ for the :class: `Text ` widget and its tags;
916+ for a tag an empty string means to use the widget's value.
851917
852918.. _Bindings-and-Events :
853919
@@ -1097,7 +1163,7 @@ Base and mixin classes
10971163 Interpret the string *s * as a Tcl boolean and return the corresponding
10981164 :class: `bool `.
10991165 Tcl accepts values such as ``'1' ``, ``'0' ``, ``'yes' ``, ``'no' ``,
1100- ``'true' `` and ``'false ' ``.
1166+ ``'true' ``, `` 'false' ``, `` 'on' `` and ``'off ' ``.
11011167 Raise :exc: `ValueError ` if *s * is not a valid boolean.
11021168
11031169 .. method :: getdouble(s)
@@ -2048,6 +2114,9 @@ Base and mixin classes
20482114
20492115 Return the geometry of the widget, in the form ``widthxheight+x+y ``.
20502116 All dimensions are in pixels.
2117+ The position is relative to the parent widget;
2118+ use :meth: `winfo_rootx ` and :meth: `winfo_rooty `
2119+ for the position on the screen.
20512120 An offset can be negative; see :meth: `~Wm.geometry `.
20522121
20532122 .. method :: winfo_height()
@@ -3201,6 +3270,8 @@ Base and mixin classes
32013270 Shift the view left or right by *number * units.
32023271 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
32033272 left and a positive one scrolls right.
3273+ The :class: `Text ` widget accepts also ``'pixels' ``,
3274+ and then *number * can be a screen distance, such as ``'1i' ``.
32043275
32053276
32063277.. class :: YView()
@@ -3231,6 +3302,8 @@ Base and mixin classes
32313302 Shift the view up or down by *number * units.
32323303 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
32333304 up and a positive one scrolls down.
3305+ The :class: `Text ` widget accepts also ``'pixels' ``,
3306+ and then *number * can be a screen distance, such as ``'1i' ``.
32343307
32353308
32363309.. class :: BaseWidget(master, widgetName, cnf={}, kw={}, extra=())
@@ -3653,8 +3726,7 @@ Widget classes
36533726
36543727 .. note ::
36553728
3656- Tk 8.6 added the *angle * option and Tk 9.0 added the *underline *
3657- option for ``text `` items.
3729+ Tk 8.6 added the *angle * option for ``text `` items.
36583730
36593731 .. method :: coords(tagOrId)
36603732 coords(tagOrId, coordList, /)
@@ -5005,10 +5077,10 @@ Widget classes
50055077 *increment * options, or an explicit list of strings given by the *values *
50065078 option (which takes precedence over the range).
50075079 Each time an arrow is invoked the *command * callback, if any, is called; the
5008- *wrap * option controls whether stepping past either end of the range wraps
5009- around to the other end; the * format * option specifies how numeric values
5010- are formatted; and the *validate * option enables validation of the entered
5011- text.
5080+ boolean *wrap * option controls whether stepping past either end of the range
5081+ wraps around to the other end;
5082+ the *format * option specifies how numeric values are formatted;
5083+ and the * validate * option enables validation of the entered text.
50125084 Inherits from :class: `Widget ` and :class: `XView `.
50135085
50145086 With a non-integer *increment *, see :ref: `numeric values and the locale
@@ -5395,7 +5467,7 @@ Widget classes
53955467 baseline, for superscripts and subscripts.
53965468
53975469 *underline *
5398- Whether to underline the text.
5470+ Whether to underline the text (a boolean) .
53995471
54005472 *underlinefg *
54015473 The color of the underline; it defaults to the text color.
@@ -5553,7 +5625,8 @@ Widget classes
55535625 Embed a window (any widget) at *index *.
55545626 The options, given in *cnf * and *kw *, include *window * (the widget to
55555627 embed), *create * (a callback that creates the widget on demand), *align *,
5556- *stretch *, *padx * and *pady *.
5628+ the boolean *stretch * (whether the widget is stretched vertically to the
5629+ height of the line), *padx * and *pady *.
55575630 The embedded widget must be a descendant of the text widget's parent.
55585631
55595632 .. method :: window_cget(index, option)
@@ -6318,7 +6391,7 @@ Module-level functions
63186391 Convert the Tcl boolean string *s * (one of ``'1' ``, ``'true' ``, ``'yes' ``,
63196392 ``'on' `` and similar, or their false counterparts) to a Python
63206393 :class: `bool `.
6321- Raise :exc: `TclError ` for an invalid value.
6394+ Raise :exc: `ValueError ` for an invalid value.
63226395
63236396.. function :: getdouble(s)
63246397
0 commit comments