@@ -773,34 +773,76 @@ Tk option data types
773773
774774Many widget options documented in the reference
775775accept values of a small number of common types, described here.
776+ The standard options and their types are described in the
777+ :manpage: `options(3tk)` manual page.
776778
777779anchor
778780 Legal values are points of the compass: ``"n" ``, ``"ne" ``, ``"e" ``, ``"se" ``,
779781 ``"s" ``, ``"sw" ``, ``"w" ``, ``"nw" ``, and also ``"center" ``.
782+ The *labelanchor * option of :class: `LabelFrame ` and
783+ :class: `ttk.LabelFrame <tkinter.ttk.LabelFrame> `
784+ accepts also ``"en" ``, ``"es" ``, ``"wn" `` and ``"ws" ``.
785+ The *sticky * option of the grid geometry manager accepts a combination
786+ of the compass directions, such as ``"nsew" ``, or an empty string.
780787
781788bitmap
782789 There are ten built-in, named bitmaps: ``'error' ``, ``'gray12' ``,
783790 ``'gray25' ``, ``'gray50' ``, ``'gray75' ``, ``'hourglass' ``, ``'info' ``,
784- ``'questhead' ``, ``'question' ``, ``'warning' ``. To specify an X bitmap
785- filename, give the full path to the file, preceded with an ``@ ``, as in
786- ``"@/usr/contrib/bitmap/gumby.bit" ``.
791+ ``'questhead' ``, ``'question' ``, ``'warning' ``.
792+ On macOS the following bitmaps are available as well:
793+ ``'application' ``, ``'accessory' ``, ``'folder' ``, ``'pfolder' ``,
794+ ``'trash' ``, ``'floppy' ``, ``'ramdisk' ``, ``'cdrom' ``, ``'preferences' ``,
795+ ``'querydoc' ``, ``'stop' ``, ``'note' `` and ``'caution' ``.
796+ To specify an X bitmap file, give the full path to the file,
797+ preceded with an ``@ ``, as in ``"@/usr/contrib/bitmap/gumby.bit" ``.
787798
788799boolean
789- You can pass integers 0 or 1 or the strings ``"yes" `` or ``"no" ``.
800+ You can pass the integers 0 or 1, ``True `` or ``False ``, or the strings
801+ ``"0" ``, ``"1" ``, ``"yes" ``, ``"no" ``, ``"true" ``, ``"false" ``, ``"on" ``
802+ or ``"off" ``.
803+ The strings are matched ignoring case,
804+ and an unambiguous prefix, such as ``"t" ``, is enough.
805+ Any non-zero integer means true.
790806
791807callback
792- This is any Python function that takes no arguments. For example::
808+ This is any callable object.
809+ Most callbacks take no arguments. For example::
793810
794811 def print_it():
795812 print("hi there")
796813 fred["command"] = print_it
797814
815+ Some options call it with arguments,
816+ such as the *command * option of :class: `Scale `,
817+ which is called with the new value.
818+
798819color
799- Colors can be given as the names of X colors in the rgb.txt file, or as strings
800- representing RGB values in 4 bit: ``"#RGB" ``, 8 bit: ``"#RRGGBB" ``, 12 bit:
801- ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" `` ranges, where R,G,B here
802- represent any legal hex digit. See the :manpage: `colors(3tk)` man page for
803- the list of named colors.
820+ Colors can be given as symbolic names, such as ``"red" `` or ``"light blue" ``,
821+ or as strings representing RGB values in 4 bit: ``"#RGB" ``, 8 bit:
822+ ``"#RRGGBB" ``, 12 bit: ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" ``
823+ ranges, where R,G,B here represent any legal hex digit.
824+ Tk provides a portable set of symbolic names available on all platforms;
825+ they are matched ignoring case and spaces,
826+ so ``"light blue" ``, ``"Light Blue" `` and ``"lightblue" ``
827+ are the same color.
828+ The full list of names, including the platform-specific names
829+ of the current system colors
830+ (for example ``"systemButtonFace" `` on Windows
831+ or ``"systemWindowBody" `` on macOS),
832+ is given in the :manpage: `colors(3tk)` manual page.
833+ :meth: `~tkinter.Misc.winfo_rgb ` returns
834+ the red, green and blue components of a color.
835+
836+ compound
837+ Determines how to combine an image and a text displayed in a widget.
838+ Legal values are ``"none" `` (display the image if there is one,
839+ otherwise the text), ``"text" ``, ``"image" ``,
840+ ``"center" `` (display the text in the center of the image) and
841+ ``"top" ``, ``"bottom" ``, ``"left" ``, ``"right" ``
842+ (display the image above, below, to the left of or to the right
843+ of the text).
844+ The themed widgets accept all these values,
845+ the classic widgets accept all except ``"text" `` and ``"image" ``.
804846
805847cursor
806848 The name of the mouse cursor to display while the pointer is over the widget.
@@ -836,19 +878,32 @@ font
836878 ``(family, size, *styles) `` (or as the equivalent string
837879 ``"Courier 10 bold" ``). Font sizes with positive numbers are measured in
838880 points; sizes with negative numbers are measured in pixels.
839-
840- geometry
841- This is a string of the form ``widthxheight ``, where width and height are
842- measured in pixels for most widgets (in characters for widgets displaying text).
843- For example: ``fred["geometry"] = "200x100" ``.
881+ The name of a named font, such as ``"TkDefaultFont" ``,
882+ a :class: `tkinter.font.Font ` instance,
883+ or, on X11, an XLFD font name can be used as well.
844884
845885justify
846886 Legal values are the strings: ``"left" ``, ``"center" ``, and ``"right" ``.
847887
888+ orient
889+ Legal values are ``"horizontal" `` and ``"vertical" ``.
890+
891+ padding
892+ This is a legal distance (see above), applied on all sides,
893+ or a sequence of up to four distances
894+ specifying the left, top, right and bottom padding.
895+ If fewer than four are specified,
896+ the bottom padding defaults to the top one,
897+ the right one to the left one, and the top one to the left one.
898+ It is only supported by the themed widgets.
899+
848900region
849- This is a string with four space-delimited elements, each of which is a legal
850- distance (see above). For example: ``"2 3 4 5" `` and ``"3i 2i 4.5i 2i" `` and
851- ``"3c 2c 4c 10.43c" `` are all legal regions.
901+ Used for the *scrollregion * option of :class: `Canvas `.
902+ This is a string with four space-delimited elements,
903+ each of which is a legal distance (see above),
904+ or a sequence of four such elements.
905+ For example: ``"2 3 4 5" ``, ``(2, 3, 4, 5) ``, ``"3i 2i 4.5i 2i" `` and
906+ ``"3c 2c 4c 10.43c" `` are all legal regions.
852907
853908relief
854909 Determines what the border style of a widget will be. Legal values are:
@@ -859,8 +914,19 @@ scrollcommand
859914 This is almost always the :meth: `!set ` method of some scrollbar widget, but can
860915 be any widget method that takes a single argument.
861916
917+ state
918+ Legal values are ``"normal" ``, ``"disabled" `` and, depending on the widget,
919+ also ``"active" ``, ``"hidden" `` (for :class: `Canvas ` items)
920+ or ``"readonly" `` (for :class: `Entry `, :class: `Spinbox `
921+ and the themed widgets).
922+ The themed widgets have in addition a more general set of states,
923+ which is manipulated with
924+ :meth: `ttk.Widget.state <tkinter.ttk.Widget.state> `.
925+
862926wrap
863- Must be one of: ``"none" ``, ``"char" ``, or ``"word" ``.
927+ Must be one of ``"none" ``, ``"char" `` or ``"word" ``
928+ for the :class: `Text ` widget and its tags;
929+ for a tag an empty string means to use the widget's value.
864930
865931.. _Bindings-and-Events :
866932
@@ -1110,7 +1176,7 @@ Base and mixin classes
11101176 Interpret the string *s * as a Tcl boolean and return the corresponding
11111177 :class: `bool `.
11121178 Tcl accepts values such as ``'1' ``, ``'0' ``, ``'yes' ``, ``'no' ``,
1113- ``'true' `` and ``'false ' ``.
1179+ ``'true' ``, `` 'false' ``, `` 'on' `` and ``'off ' ``.
11141180 Raise :exc: `ValueError ` if *s * is not a valid boolean.
11151181
11161182 .. method :: getdouble(s)
@@ -2143,6 +2209,9 @@ Base and mixin classes
21432209
21442210 Return the geometry of the widget, in the form ``widthxheight+x+y ``.
21452211 All dimensions are in pixels.
2212+ The position is relative to the parent widget;
2213+ use :meth: `winfo_rootx ` and :meth: `winfo_rooty `
2214+ for the position on the screen.
21462215 An offset can be negative; see :meth: `~Wm.geometry `.
21472216
21482217 .. method :: winfo_height()
@@ -3369,6 +3438,8 @@ Base and mixin classes
33693438 Shift the view left or right by *number * units.
33703439 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
33713440 left and a positive one scrolls right.
3441+ The :class: `Text ` widget accepts also ``'pixels' ``,
3442+ and then *number * can be a screen distance, such as ``'1i' ``.
33723443
33733444
33743445.. class :: YView()
@@ -3399,6 +3470,8 @@ Base and mixin classes
33993470 Shift the view up or down by *number * units.
34003471 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
34013472 up and a positive one scrolls down.
3473+ The :class: `Text ` widget accepts also ``'pixels' ``,
3474+ and then *number * can be a screen distance, such as ``'1i' ``.
34023475
34033476
34043477.. class :: BaseWidget(master, widgetName, cnf={}, kw={}, extra=())
@@ -3828,8 +3901,7 @@ Widget classes
38283901
38293902 .. note ::
38303903
3831- Tk 8.6 added the *angle * option and Tk 9.0 added the *underline *
3832- option for ``text `` items.
3904+ Tk 8.6 added the *angle * option for ``text `` items.
38333905
38343906 .. method :: coords(tagOrId)
38353907 coords(tagOrId, coordList, /)
@@ -5226,10 +5298,10 @@ Widget classes
52265298 *increment * options, or an explicit list of strings given by the *values *
52275299 option (which takes precedence over the range).
52285300 Each time an arrow is invoked the *command * callback, if any, is called; the
5229- *wrap * option controls whether stepping past either end of the range wraps
5230- around to the other end; the * format * option specifies how numeric values
5231- are formatted; and the *validate * option enables validation of the entered
5232- text.
5301+ boolean *wrap * option controls whether stepping past either end of the range
5302+ wraps around to the other end;
5303+ the *format * option specifies how numeric values are formatted;
5304+ and the * validate * option enables validation of the entered text.
52335305 Inherits from :class: `Widget ` and :class: `XView `.
52345306
52355307 With a non-integer *increment *, see :ref: `numeric values and the locale
@@ -5631,7 +5703,7 @@ Widget classes
56315703 baseline, for superscripts and subscripts.
56325704
56335705 *underline *
5634- Whether to underline the text.
5706+ Whether to underline the text (a boolean) .
56355707
56365708 *underlinefg *
56375709 The color of the underline; it defaults to the text color.
@@ -5789,7 +5861,8 @@ Widget classes
57895861 Embed a window (any widget) at *index *.
57905862 The options, given in *cnf * and *kw *, include *window * (the widget to
57915863 embed), *create * (a callback that creates the widget on demand), *align *,
5792- *stretch *, *padx * and *pady *.
5864+ the boolean *stretch * (whether the widget is stretched vertically to the
5865+ height of the line), *padx * and *pady *.
57935866 The embedded widget must be a descendant of the text widget's parent.
57945867
57955868 .. method :: window_cget(index, option)
@@ -6665,7 +6738,7 @@ Module-level functions
66656738 Convert the Tcl boolean string *s * (one of ``'1' ``, ``'true' ``, ``'yes' ``,
66666739 ``'on' `` and similar, or their false counterparts) to a Python
66676740 :class: `bool `.
6668- Raise :exc: `TclError ` for an invalid value.
6741+ Raise :exc: `ValueError ` for an invalid value.
66696742
66706743.. function :: getdouble(s)
66716744
0 commit comments