From 062759f1dcfc025d1aae430ad89e22b8fd02dbf2 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 30 Jul 2015 21:16:16 -0400 Subject: [PATCH] Issue 24759: Gracefull exit Idle if ttk import fails. --- Lib/idlelib/PyShell.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index a5236ab476e..12233fb86fd 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -23,6 +23,16 @@ except ImportError: "Your Python may not be configured for Tk. **", file=sys.__stderr__) sys.exit(1) import tkinter.messagebox as tkMessageBox +try: + from tkinter import ttk +except: + root = Tk() + root.withdraw() + tkMessageBox.showerror("Idle Cannot Start", + "Idle now requires the tkinter.ttk module from tcl/tk 8.5+.\n" + + "It found tk %s and no ttk." % TkVersion, + parent=root) + sys.exit(1) from idlelib.EditorWindow import EditorWindow, fixwordbreaks from idlelib.FileList import FileList