Skip to content

Commit 2a85a1a

Browse files
committed
Issue 24759: Gracefull exit Idle if ttk import fails.
1 parent 0c38939 commit 2a85a1a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Lib/idlelib/PyShell.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
2424
sys.exit(1)
2525
import tkMessageBox
26+
try:
27+
import ttk
28+
except:
29+
root = Tk()
30+
root.withdraw()
31+
tkMessageBox.showerror("Idle Cannot Start",
32+
"Idle now requires the Tkinter ttk module from tcl/tk 8.5+.\n"
33+
+ "It found tk %s and no ttk." % TkVersion,
34+
parent=root)
35+
sys.exit(1)
2636

2737
from idlelib.EditorWindow import EditorWindow, fixwordbreaks
2838
from idlelib.FileList import FileList

0 commit comments

Comments
 (0)