Skip to content

Commit ea57037

Browse files
gh-76607: Improve documentation of the tkinter cursor option (GH-152481)
Link to the cursors(3tk) manual page for the available cursor names and note that they are platform-dependent. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 70100b9 commit ea57037

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

Doc/library/tkinter.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ Here are some examples of typical usage::
737737
myapp.mainloop()
738738

739739

740+
.. _Tk-option-data-types:
741+
740742
Tk option data types
741743
^^^^^^^^^^^^^^^^^^^^
742744

@@ -770,12 +772,16 @@ color
770772
represent any legal hex digit. See page 160 of Ousterhout's book for details.
771773

772774
cursor
773-
The standard X cursor names from :file:`cursorfont.h` can be used, without the
774-
``XC_`` prefix. For example to get a hand cursor (``XC_hand2``), use the
775-
string ``"hand2"``. You can also specify a bitmap and mask file of your own.
775+
The name of the mouse cursor to display while the pointer is over the widget.
776+
Tk provides a portable set of cursor names available on all platforms
777+
(for example ``"arrow"``, ``"watch"``, ``"cross"``, or ``"hand2"``);
778+
the standard X cursor names from :file:`cursorfont.h` may also be used,
779+
without the ``XC_`` prefix (so ``XC_hand2`` becomes ``"hand2"``).
780+
The full list of names, including the platform-specific ones,
781+
is given in the :manpage:`cursors(3tk)` manual page.
782+
You can also specify a bitmap and mask file of your own.
776783
On Windows a cursor file (:file:`.cur` or :file:`.ani`) may be used directly,
777784
giving its path preceded with an ``@``, as in ``"@C:/cursors/bart.ani"``.
778-
See page 179 of Ousterhout's book.
779785

780786
distance
781787
Screen distances can be specified in either pixels or absolute distances.

Doc/library/tkinter.ttk.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ All the :mod:`!ttk` Widgets accept the following options:
116116
| | read-only, and may only be specified when the window is |
117117
| | created. |
118118
+-----------+--------------------------------------------------------------+
119-
| cursor | Specifies the mouse cursor to be used for the widget. If set |
120-
| | to the empty string (the default), the cursor is inherited |
121-
| | from the parent widget. |
119+
| cursor | Specifies the mouse cursor to be used for the widget. See |
120+
| | the *cursor* option type under :ref:`Tk-option-data-types`. |
121+
| | If set to the empty string (the default), the cursor is |
122+
| | inherited from the parent widget. |
122123
+-----------+--------------------------------------------------------------+
123124
| takefocus | Determines whether the window accepts the focus during |
124125
| | keyboard traversal. 0, 1 or an empty string is returned. |

0 commit comments

Comments
 (0)