mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
bpo-43013: Fix old tkinter module names in idlelib (GH-24326)
Lowercase 'tkColorChooser', 'tkFileDialog', 'tkSimpleDialog', and 'tkMessageBox' and remove 'tk'. Just lowercase 'tkFont' as 'font' is already used. Adjust import.
This commit is contained in:
parent
cf19cc3b92
commit
879986d8a9
13 changed files with 66 additions and 67 deletions
|
@ -21,13 +21,13 @@ if sys.platform == 'win32':
|
|||
except (ImportError, AttributeError, OSError):
|
||||
pass
|
||||
|
||||
import tkinter.messagebox as tkMessageBox
|
||||
from tkinter import messagebox
|
||||
if TkVersion < 8.5:
|
||||
root = Tk() # otherwise create root in main
|
||||
root.withdraw()
|
||||
from idlelib.run import fix_scaling
|
||||
fix_scaling(root)
|
||||
tkMessageBox.showerror("Idle Cannot Start",
|
||||
messagebox.showerror("Idle Cannot Start",
|
||||
"Idle requires tcl/tk 8.5+, not %s." % TkVersion,
|
||||
parent=root)
|
||||
raise SystemExit(1)
|
||||
|
@ -261,7 +261,7 @@ class PyShellEditorWindow(EditorWindow):
|
|||
except OSError as err:
|
||||
if not getattr(self.root, "breakpoint_error_displayed", False):
|
||||
self.root.breakpoint_error_displayed = True
|
||||
tkMessageBox.showerror(title='IDLE Error',
|
||||
messagebox.showerror(title='IDLE Error',
|
||||
message='Unable to update breakpoint list:\n%s'
|
||||
% str(err),
|
||||
parent=self.text)
|
||||
|
@ -771,7 +771,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
exec(code, self.locals)
|
||||
except SystemExit:
|
||||
if not self.tkconsole.closing:
|
||||
if tkMessageBox.askyesno(
|
||||
if messagebox.askyesno(
|
||||
"Exit?",
|
||||
"Do you want to exit altogether?",
|
||||
default="yes",
|
||||
|
@ -805,7 +805,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
return self.tkconsole.stderr.write(s)
|
||||
|
||||
def display_port_binding_error(self):
|
||||
tkMessageBox.showerror(
|
||||
messagebox.showerror(
|
||||
"Port Binding Error",
|
||||
"IDLE can't bind to a TCP/IP port, which is necessary to "
|
||||
"communicate with its Python execution server. This might be "
|
||||
|
@ -816,7 +816,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
parent=self.tkconsole.text)
|
||||
|
||||
def display_no_subprocess_error(self):
|
||||
tkMessageBox.showerror(
|
||||
messagebox.showerror(
|
||||
"Subprocess Connection Error",
|
||||
"IDLE's subprocess didn't make connection.\n"
|
||||
"See the 'Startup failure' section of the IDLE doc, online at\n"
|
||||
|
@ -824,7 +824,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
parent=self.tkconsole.text)
|
||||
|
||||
def display_executing_dialog(self):
|
||||
tkMessageBox.showerror(
|
||||
messagebox.showerror(
|
||||
"Already executing",
|
||||
"The Python Shell window is already executing a command; "
|
||||
"please wait until it is finished.",
|
||||
|
@ -945,7 +945,7 @@ class PyShell(OutputWindow):
|
|||
|
||||
def toggle_debugger(self, event=None):
|
||||
if self.executing:
|
||||
tkMessageBox.showerror("Don't debug now",
|
||||
messagebox.showerror("Don't debug now",
|
||||
"You can only toggle the debugger when idle",
|
||||
parent=self.text)
|
||||
self.set_debugger_indicator()
|
||||
|
@ -1003,7 +1003,7 @@ class PyShell(OutputWindow):
|
|||
def close(self):
|
||||
"Extend EditorWindow.close()"
|
||||
if self.executing:
|
||||
response = tkMessageBox.askokcancel(
|
||||
response = messagebox.askokcancel(
|
||||
"Kill?",
|
||||
"Your program is still running!\n Do you want to kill it?",
|
||||
default="ok",
|
||||
|
@ -1254,7 +1254,7 @@ class PyShell(OutputWindow):
|
|||
try:
|
||||
sys.last_traceback
|
||||
except:
|
||||
tkMessageBox.showerror("No stack trace",
|
||||
messagebox.showerror("No stack trace",
|
||||
"There is no stack trace yet.\n"
|
||||
"(sys.last_traceback is not defined)",
|
||||
parent=self.text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue