[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
from tkinter import *
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
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?
from tkinter import ttk
root = Tk()
tkMessageBox.showerror("Fatal Idle Import Error",
"Idle cannot import required module tkinter.ttk.\n"
"Click OK to exit.",
nosy: markroseman, terry.reedy
stage: needs patch
title: Idle: require 8.5 / ttk
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce