[New-bugs-announce] [issue24759] Idle: require 8.5 / ttk

Terry J. Reedy report at bugs.python.org
Fri Jul 31 00:18:35 CEST 2015


New submission from Terry J. Reedy:

PyShell currently has this code

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

When Idle is started from an icon, there is no place for the error message to go, so it appears than nothing happens.  But this is the best we can do without invoking system specific error message functions.  (This, if possible, would be another issue.) The second import assumes that messagebox is available, which is should be without modification of the tkinter package since long ago.  But I think we should guard against someone trying to start Idle on pre 8.5.  The following seems to work nicely.  This is a prerequisite for any ttk patches.  Any comment before I apply?

try:
    from tkinter import ttk
except:
    root = Tk()
    root.withdraw()
    tkMessageBox.showerror("Fatal Idle Import Error",
            "Idle cannot import required module tkinter.ttk.\n"
            "Click OK to exit.",
            parent=root)
    sys.exit(1)

----------
assignee: terry.reedy
messages: 247701
nosy: markroseman, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Idle: require 8.5 / ttk
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24759>
_______________________________________


More information about the New-bugs-announce mailing list