@@ -767,34 +767,76 @@ Tk option data types
767767
768768Many widget options documented in the reference
769769accept values of a small number of common types, described here.
770+ The standard options and their types are described in the
771+ :manpage: `options(3tk)` manual page.
770772
771773anchor
772774 Legal values are points of the compass: ``"n" ``, ``"ne" ``, ``"e" ``, ``"se" ``,
773775 ``"s" ``, ``"sw" ``, ``"w" ``, ``"nw" ``, and also ``"center" ``.
776+ The *labelanchor * option of :class: `LabelFrame ` and
777+ :class: `ttk.LabelFrame <tkinter.ttk.LabelFrame> `
778+ accepts also ``"en" ``, ``"es" ``, ``"wn" `` and ``"ws" ``.
779+ The *sticky * option of the grid geometry manager accepts a combination
780+ of the compass directions, such as ``"nsew" ``, or an empty string.
774781
775782bitmap
776783 There are ten built-in, named bitmaps: ``'error' ``, ``'gray12' ``,
777784 ``'gray25' ``, ``'gray50' ``, ``'gray75' ``, ``'hourglass' ``, ``'info' ``,
778- ``'questhead' ``, ``'question' ``, ``'warning' ``. To specify an X bitmap
779- filename, give the full path to the file, preceded with an ``@ ``, as in
780- ``"@/usr/contrib/bitmap/gumby.bit" ``.
785+ ``'questhead' ``, ``'question' ``, ``'warning' ``.
786+ On macOS the following bitmaps are available as well:
787+ ``'application' ``, ``'accessory' ``, ``'folder' ``, ``'pfolder' ``,
788+ ``'trash' ``, ``'floppy' ``, ``'ramdisk' ``, ``'cdrom' ``, ``'preferences' ``,
789+ ``'querydoc' ``, ``'stop' ``, ``'note' `` and ``'caution' ``.
790+ To specify an X bitmap file, give the full path to the file,
791+ preceded with an ``@ ``, as in ``"@/usr/contrib/bitmap/gumby.bit" ``.
781792
782793boolean
783- You can pass integers 0 or 1 or the strings ``"yes" `` or ``"no" ``.
794+ You can pass the integers 0 or 1, ``True `` or ``False ``, or the strings
795+ ``"0" ``, ``"1" ``, ``"yes" ``, ``"no" ``, ``"true" ``, ``"false" ``, ``"on" ``
796+ or ``"off" ``.
797+ The strings are matched ignoring case,
798+ and an unambiguous prefix, such as ``"t" ``, is enough.
799+ Any non-zero integer means true.
784800
785801callback
786- This is any Python function that takes no arguments. For example::
802+ This is any callable object.
803+ Most callbacks take no arguments. For example::
787804
788805 def print_it():
789806 print("hi there")
790807 fred["command"] = print_it
791808
809+ Some options call it with arguments,
810+ such as the *command * option of :class: `Scale `,
811+ which is called with the new value.
812+
792813color
793- Colors can be given as the names of X colors in the rgb.txt file, or as strings
794- representing RGB values in 4 bit: ``"#RGB" ``, 8 bit: ``"#RRGGBB" ``, 12 bit:
795- ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" `` ranges, where R,G,B here
796- represent any legal hex digit. See the :manpage: `colors(3tk)` man page for
797- the list of named colors.
814+ Colors can be given as symbolic names, such as ``"red" `` or ``"light blue" ``,
815+ or as strings representing RGB values in 4 bit: ``"#RGB" ``, 8 bit:
816+ ``"#RRGGBB" ``, 12 bit: ``"#RRRGGGBBB" ``, or 16 bit: ``"#RRRRGGGGBBBB" ``
817+ ranges, where R,G,B here represent any legal hex digit.
818+ Tk provides a portable set of symbolic names available on all platforms;
819+ they are matched ignoring case and spaces,
820+ so ``"light blue" ``, ``"Light Blue" `` and ``"lightblue" ``
821+ are the same color.
822+ The full list of names, including the platform-specific names
823+ of the current system colors
824+ (for example ``"systemButtonFace" `` on Windows
825+ or ``"systemWindowBody" `` on macOS),
826+ is given in the :manpage: `colors(3tk)` manual page.
827+ :meth: `~tkinter.Misc.winfo_rgb ` returns
828+ the red, green and blue components of a color.
829+
830+ compound
831+ Determines how to combine an image and a text displayed in a widget.
832+ Legal values are ``"none" `` (display the image if there is one,
833+ otherwise the text), ``"text" ``, ``"image" ``,
834+ ``"center" `` (display the text in the center of the image) and
835+ ``"top" ``, ``"bottom" ``, ``"left" ``, ``"right" ``
836+ (display the image above, below, to the left of or to the right
837+ of the text).
838+ The themed widgets accept all these values,
839+ the classic widgets accept all except ``"text" `` and ``"image" ``.
798840
799841cursor
800842 The name of the mouse cursor to display while the pointer is over the widget.
@@ -821,19 +863,32 @@ font
821863 ``(family, size, *styles) `` (or as the equivalent string
822864 ``"Courier 10 bold" ``). Font sizes with positive numbers are measured in
823865 points; sizes with negative numbers are measured in pixels.
824-
825- geometry
826- This is a string of the form ``widthxheight ``, where width and height are
827- measured in pixels for most widgets (in characters for widgets displaying text).
828- For example: ``fred["geometry"] = "200x100" ``.
866+ The name of a named font, such as ``"TkDefaultFont" ``,
867+ a :class: `tkinter.font.Font ` instance,
868+ or, on X11, an XLFD font name can be used as well.
829869
830870justify
831871 Legal values are the strings: ``"left" ``, ``"center" ``, and ``"right" ``.
832872
873+ orient
874+ Legal values are ``"horizontal" `` and ``"vertical" ``.
875+
876+ padding
877+ This is a legal distance (see above), applied on all sides,
878+ or a sequence of up to four distances
879+ specifying the left, top, right and bottom padding.
880+ If fewer than four are specified,
881+ the bottom padding defaults to the top one,
882+ the right one to the left one, and the top one to the left one.
883+ It is only supported by the themed widgets.
884+
833885region
834- This is a string with four space-delimited elements, each of which is a legal
835- distance (see above). For example: ``"2 3 4 5" `` and ``"3i 2i 4.5i 2i" `` and
836- ``"3c 2c 4c 10.43c" `` are all legal regions.
886+ Used for the *scrollregion * option of :class: `Canvas `.
887+ This is a string with four space-delimited elements,
888+ each of which is a legal distance (see above),
889+ or a sequence of four such elements.
890+ For example: ``"2 3 4 5" ``, ``(2, 3, 4, 5) ``, ``"3i 2i 4.5i 2i" `` and
891+ ``"3c 2c 4c 10.43c" `` are all legal regions.
837892
838893relief
839894 Determines what the border style of a widget will be. Legal values are:
@@ -844,8 +899,19 @@ scrollcommand
844899 This is almost always the :meth: `!set ` method of some scrollbar widget, but can
845900 be any widget method that takes a single argument.
846901
902+ state
903+ Legal values are ``"normal" ``, ``"disabled" `` and, depending on the widget,
904+ also ``"active" ``, ``"hidden" `` (for :class: `Canvas ` items)
905+ or ``"readonly" `` (for :class: `Entry `, :class: `Spinbox `
906+ and the themed widgets).
907+ The themed widgets have in addition a more general set of states,
908+ which is manipulated with
909+ :meth: `ttk.Widget.state <tkinter.ttk.Widget.state> `.
910+
847911wrap
848- Must be one of: ``"none" ``, ``"char" ``, or ``"word" ``.
912+ Must be one of ``"none" ``, ``"char" `` or ``"word" ``
913+ for the :class: `Text ` widget and its tags;
914+ for a tag an empty string means to use the widget's value.
849915
850916.. _Bindings-and-Events :
851917
@@ -1095,7 +1161,7 @@ Base and mixin classes
10951161 Interpret the string *s * as a Tcl boolean and return the corresponding
10961162 :class: `bool `.
10971163 Tcl accepts values such as ``'1' ``, ``'0' ``, ``'yes' ``, ``'no' ``,
1098- ``'true' `` and ``'false ' ``.
1164+ ``'true' ``, `` 'false' ``, `` 'on' `` and ``'off ' ``.
10991165 Raise :exc: `ValueError ` if *s * is not a valid boolean.
11001166
11011167 .. method :: getdouble(s)
@@ -2077,6 +2143,9 @@ Base and mixin classes
20772143
20782144 Return the geometry of the widget, in the form ``widthxheight+x+y ``.
20792145 All dimensions are in pixels.
2146+ The position is relative to the parent widget;
2147+ use :meth: `winfo_rootx ` and :meth: `winfo_rooty `
2148+ for the position on the screen.
20802149 An offset can be negative; see :meth: `~Wm.geometry `.
20812150
20822151 .. method :: winfo_height()
@@ -3258,6 +3327,8 @@ Base and mixin classes
32583327 Shift the view left or right by *number * units.
32593328 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
32603329 left and a positive one scrolls right.
3330+ The :class: `Text ` widget accepts also ``'pixels' ``,
3331+ and then *number * can be a screen distance, such as ``'1i' ``.
32613332
32623333
32633334.. class :: YView()
@@ -3288,6 +3359,8 @@ Base and mixin classes
32883359 Shift the view up or down by *number * units.
32893360 *what * is either ``'units' `` or ``'pages' ``; a negative *number * scrolls
32903361 up and a positive one scrolls down.
3362+ The :class: `Text ` widget accepts also ``'pixels' ``,
3363+ and then *number * can be a screen distance, such as ``'1i' ``.
32913364
32923365
32933366.. class :: BaseWidget(master, widgetName, cnf={}, kw={}, extra=())
@@ -3710,8 +3783,7 @@ Widget classes
37103783
37113784 .. note ::
37123785
3713- Tk 8.6 added the *angle * option and Tk 9.0 added the *underline *
3714- option for ``text `` items.
3786+ Tk 8.6 added the *angle * option for ``text `` items.
37153787
37163788 .. method :: coords(tagOrId)
37173789 coords(tagOrId, coordList, /)
@@ -5062,10 +5134,10 @@ Widget classes
50625134 *increment * options, or an explicit list of strings given by the *values *
50635135 option (which takes precedence over the range).
50645136 Each time an arrow is invoked the *command * callback, if any, is called; the
5065- *wrap * option controls whether stepping past either end of the range wraps
5066- around to the other end; the * format * option specifies how numeric values
5067- are formatted; and the *validate * option enables validation of the entered
5068- text.
5137+ boolean *wrap * option controls whether stepping past either end of the range
5138+ wraps around to the other end;
5139+ the *format * option specifies how numeric values are formatted;
5140+ and the * validate * option enables validation of the entered text.
50695141 Inherits from :class: `Widget ` and :class: `XView `.
50705142
50715143 With a non-integer *increment *, see :ref: `numeric values and the locale
@@ -5452,7 +5524,7 @@ Widget classes
54525524 baseline, for superscripts and subscripts.
54535525
54545526 *underline *
5455- Whether to underline the text.
5527+ Whether to underline the text (a boolean) .
54565528
54575529 *underlinefg *
54585530 The color of the underline; it defaults to the text color.
@@ -5610,7 +5682,8 @@ Widget classes
56105682 Embed a window (any widget) at *index *.
56115683 The options, given in *cnf * and *kw *, include *window * (the widget to
56125684 embed), *create * (a callback that creates the widget on demand), *align *,
5613- *stretch *, *padx * and *pady *.
5685+ the boolean *stretch * (whether the widget is stretched vertically to the
5686+ height of the line), *padx * and *pady *.
56145687 The embedded widget must be a descendant of the text widget's parent.
56155688
56165689 .. method :: window_cget(index, option)
@@ -6409,7 +6482,7 @@ Module-level functions
64096482 Convert the Tcl boolean string *s * (one of ``'1' ``, ``'true' ``, ``'yes' ``,
64106483 ``'on' `` and similar, or their false counterparts) to a Python
64116484 :class: `bool `.
6412- Raise :exc: `TclError ` for an invalid value.
6485+ Raise :exc: `ValueError ` for an invalid value.
64136486
64146487.. function :: getdouble(s)
64156488
0 commit comments