]> granicus.if.org Git - python/commitdiff
Issue 24759: Gracefull exit Idle if ttk import fails.
authorTerry Jan Reedy <tjreedy@udel.edu>
Fri, 31 Jul 2015 01:16:16 +0000 (21:16 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Fri, 31 Jul 2015 01:16:16 +0000 (21:16 -0400)
Lib/idlelib/PyShell.py

index a5236ab476e030066eaf19d954ac108e0c6f0680..12233fb86fda471d0dfeaf936cad503348b12bbb 100755 (executable)
@@ -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