Skip to content

Commit 2d3aab2

Browse files
committed
gh-43720: IDLE - use tk text print when available
The new tk print command is available in tk 9.0. When running tk 8.6, fall back to old code.
1 parent 1b3914a commit 2d3aab2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/idlelib/iomenu.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,12 @@ def encode(self, chars):
326326
return chars.encode('utf-8-sig')
327327

328328
def print_window(self, event):
329+
try:
330+
self.text.tk.call('tk', 'print', self.text)
331+
except tkinter.TclError:
332+
self.old_print(event)
333+
334+
def old_print(self, event):
329335
confirm = messagebox.askokcancel(
330336
title="Print",
331337
message="Print to Default Printer",

0 commit comments

Comments
 (0)