Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 062759f

Browse files
committed
Issue 24759: Gracefull exit Idle if ttk import fails.
1 parent 5ccc18f commit 062759f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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 tkinter.messagebox as tkMessageBox
26+
try:
27+
from tkinter 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)