Author terry.reedy
Recipients markroseman, terry.reedy
Date 2015-07-30.22:18:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438294715.65.0.966229055462.issue24759@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-07-30 22:18:35terry.reedysetrecipients: + terry.reedy, markroseman
2015-07-30 22:18:35terry.reedysetmessageid: <1438294715.65.0.966229055462.issue24759@psf.upfronthosting.co.za>
2015-07-30 22:18:35terry.reedylinkissue24759 messages
2015-07-30 22:18:35terry.reedycreate