Skip to content

gh-153256: Add tk_print() methods to tkinter Canvas and Text#153257

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-tk-print
Jul 11, 2026
Merged

gh-153256: Add tk_print() methods to tkinter Canvas and Text#153257
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-tk-print

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 7, 2026

Copy link
Copy Markdown
Member

Add a tk_print() method to tkinter.Canvas and tkinter.Text wrapping the tk print command (Tk 8.7/9.0 and newer), which opens the native platform print dialog to print the contents of the widget.

Since tk print only supports canvas and text widgets, the method is added to those two classes rather than to the common Misc base class.

Calling the method opens the native print dialog, so it cannot be exercised in the test suite; the test only checks that the method is present on Canvas and Text and absent elsewhere.

The native print dialog (the "tk print" command, Tk 8.7/9.0+) only
supports canvas and text widgets, so expose it as a method of Canvas
and Text rather than of Misc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jul 7, 2026

Copy link
Copy Markdown

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) July 11, 2026 04:39
@serhiy-storchaka serhiy-storchaka merged commit 45fa07b into python:main Jul 11, 2026
51 checks passed
@serhiy-storchaka serhiy-storchaka deleted the tkinter-tk-print branch July 11, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant