summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2015-07-31 01:16:16 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2015-07-31 01:16:16 (GMT)
commit062759f1dcfc025d1aae430ad89e22b8fd02dbf2 (patch)
tree3eeda7fcf5c825730f437fde56554b220ca880d8
parent5ccc18f29844b55a43bf8f26dffeb39057477dea (diff)
downloadcpython-062759f1dcfc025d1aae430ad89e22b8fd02dbf2.zip
cpython-062759f1dcfc025d1aae430ad89e22b8fd02dbf2.tar.gz
cpython-062759f1dcfc025d1aae430ad89e22b8fd02dbf2.tar.bz2
Issue 24759: Gracefull exit Idle if ttk import fails.
-rwxr-xr-xLib/idlelib/PyShell.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index a5236ab..12233fb 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