Skip to content

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

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:tkinter-tk-print
Open

gh-153256: Add tk_print() methods to tkinter Canvas and Text#153257
serhiy-storchaka wants to merge 1 commit 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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33477019 | 📁 Comparing aa50e0b against main (2cd5b79)

  🔍 Preview build  

3 files changed
± library/tkinter.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant