https://github.com/python/cpython/commit/0f98c6671ae8f2f5b9b5d502e10316761cc681e1 commit: 0f98c6671ae8f2f5b9b5d502e10316761cc681e1 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-06-27T11:46:08Z summary:
[3.14] gh-70273: Document default class bindings in tkinter (GH-152389) (GH-152394) Note in the Bindings and events section that every widget inherits Tk class bindings for its standard behavior, where they are documented, and how to suppress an unwanted one by returning "break" from a callback. (cherry picked from commit 4fd69ef97a67fc935e0d4f30662f2a1985ba6be9) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> files: M Doc/library/tkinter.rst diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 3f8bd75a9698e1..8c0349921b614f 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -887,6 +887,20 @@ they are denoted in Tk, which can be useful when referring to the Tk man pages. | %d | detail | %D | delta | +----+---------------------+----+---------------------+ +The ``add`` parameter above only affects the bindings you make yourself. +Every widget also inherits *class bindings* +that implement its standard behavior -- +for example a :class:`Text` widget binds :kbd:`Control-t` +to transpose two characters. +These are described in the bindings section of the widget's Tk man page +(such as :manpage:`text(3tk)` or :manpage:`entry(3tk)`). + +Class bindings are processed separately from your own, +so binding an event yourself does not replace the default; both run. +To suppress an unwanted default binding, +bind the event on the widget +and return the string ``"break"`` from your callback. + The index parameter ^^^^^^^^^^^^^^^^^^^ _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
