diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py index 9560aaa2da0c424..5abc4efa77126f2 100644 --- a/Lib/idlelib/iomenu.py +++ b/Lib/idlelib/iomenu.py @@ -326,6 +326,12 @@ def encode(self, chars): return chars.encode('utf-8-sig') def print_window(self, event): + try: + self.text.tk.call('tk', 'print', self.text) + except tkinter.TclError: + self.old_print(event) + + def old_print(self, event): confirm = messagebox.askokcancel( title="Print", message="Print to Default Printer", diff --git a/Misc/NEWS.d/next/IDLE/2026-07-15-01-29-18.gh-issue-43720.a2C8SZ.rst b/Misc/NEWS.d/next/IDLE/2026-07-15-01-29-18.gh-issue-43720.a2C8SZ.rst new file mode 100644 index 000000000000000..425ecf1753c0a2e --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2026-07-15-01-29-18.gh-issue-43720.a2C8SZ.rst @@ -0,0 +1 @@ +Use tk text print when running tk 9.0+. Patch by Terry J. Reedy.