summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/pyshell.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2016-06-10 01:09:15 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2016-06-10 01:09:15 (GMT)
commit1080d13a7da30df34de7862ea46525c2f19091c7 (patch)
tree3af70dcfb4ec7b735b79f03ac10e4c1783666894 /Lib/idlelib/pyshell.py
parent82ae15597f1af7a0121ebf49e749dda673d4e3d6 (diff)
downloadcpython-1080d13a7da30df34de7862ea46525c2f19091c7.zip
cpython-1080d13a7da30df34de7862ea46525c2f19091c7.tar.gz
cpython-1080d13a7da30df34de7862ea46525c2f19091c7.tar.bz2
Issue #24759: IDLE requires tk 8.5 and availability ttk widgets.
Delete now unneeded tk version tests and code for older versions.
Diffstat (limited to 'Lib/idlelib/pyshell.py')
-rwxr-xr-xLib/idlelib/pyshell.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 9fc46ca..38c12cd 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -1,5 +1,20 @@
#! /usr/bin/env python3
+try:
+ from tkinter import *
+except ImportError:
+ print("** IDLE can't import Tkinter.\n"
+ "Your Python may not be configured for Tk. **", file=sys.__stderr__)
+ sys.exit(1)
+import tkinter.messagebox as tkMessageBox
+if TkVersion < 8.5:
+ root = Tk() # otherwise create root in main
+ root.withdraw()
+ tkMessageBox.showerror("Idle Cannot Start",
+ "Idle requires tcl/tk 8.5+, not $s." % TkVersion,
+ parent=root)
+ sys.exit(1)
+
import getopt
import os
import os.path
@@ -16,14 +31,6 @@ import linecache
from code import InteractiveInterpreter
from platform import python_version, system
-try:
- from tkinter import *
-except ImportError:
- print("** IDLE can't import Tkinter.\n"
- "Your Python may not be configured for Tk. **", file=sys.__stderr__)
- sys.exit(1)
-import tkinter.messagebox as tkMessageBox
-
from idlelib.editor import EditorWindow, fixwordbreaks
from idlelib.filelist import FileList
from idlelib.colorizer import ColorDelegator
@@ -1536,7 +1543,7 @@ def main():
if system() == 'Windows':
iconfile = os.path.join(icondir, 'idle.ico')
root.wm_iconbitmap(default=iconfile)
- elif TkVersion >= 8.5:
+ else:
ext = '.png' if TkVersion >= 8.6 else '.gif'
iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext))
for size in (16, 32, 48)]