Issue #25173: Replace 'master' with 'parent' in tkinter.messagebox calls.

This associates the message box with the widget and is better for Mac OSX.
Patch by Mark Roseman.
This commit is contained in:
Terry Jan Reedy 2015-09-25 22:22:55 -04:00
parent cbe16aefb8
commit 3be2e54adc
5 changed files with 20 additions and 20 deletions

View file

@ -217,7 +217,7 @@ class IOBinding:
f.seek(0)
bytes = f.read()
except OSError as msg:
tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
tkMessageBox.showerror("I/O Error", str(msg), parent=self.text)
return False
chars, converted = self._decode(two_lines, bytes)
if chars is None:
@ -266,7 +266,7 @@ class IOBinding:
title="Error loading the file",
message="The encoding '%s' is not known to this Python "\
"installation. The file may not display correctly" % name,
master = self.text)
parent = self.text)
enc = None
except UnicodeDecodeError:
return None, False
@ -321,7 +321,7 @@ class IOBinding:
title="Save On Close",
message=message,
default=tkMessageBox.YES,
master=self.text)
parent=self.text)
if confirm:
reply = "yes"
self.save(None)
@ -381,7 +381,7 @@ class IOBinding:
return True
except OSError as msg:
tkMessageBox.showerror("I/O Error", str(msg),
master=self.text)
parent=self.text)
return False
def encode(self, chars):
@ -418,7 +418,7 @@ class IOBinding:
tkMessageBox.showerror(
"I/O Error",
"%s.\nSaving as UTF-8" % failed,
master = self.text)
parent = self.text)
# Fallback: save as UTF-8, with BOM - ignoring the incorrect
# declared encoding
return BOM_UTF8 + chars.encode("utf-8")
@ -433,7 +433,7 @@ class IOBinding:
title="Print",
message="Print to Default Printer",
default=tkMessageBox.OK,
master=self.text)
parent=self.text)
if not confirm:
self.text.focus_set()
return "break"
@ -470,10 +470,10 @@ class IOBinding:
status + output
if output:
output = "Printing command: %s\n" % repr(command) + output
tkMessageBox.showerror("Print status", output, master=self.text)
tkMessageBox.showerror("Print status", output, parent=self.text)
else: #no printing for this platform
message = "Printing is not enabled for this platform: %s" % platform
tkMessageBox.showinfo("Print status", message, master=self.text)
tkMessageBox.showinfo("Print status", message, parent=self.text)
if tempfilename:
os.unlink(tempfilename)
return "break"
@ -492,7 +492,7 @@ class IOBinding:
def askopenfile(self):
dir, base = self.defaultfilename("open")
if not self.opendialog:
self.opendialog = tkFileDialog.Open(master=self.text,
self.opendialog = tkFileDialog.Open(parent=self.text,
filetypes=self.filetypes)
filename = self.opendialog.show(initialdir=dir, initialfile=base)
return filename
@ -513,7 +513,7 @@ class IOBinding:
dir, base = self.defaultfilename("save")
if not self.savedialog:
self.savedialog = tkFileDialog.SaveAs(
master=self.text,
parent=self.text,
filetypes=self.filetypes,
defaultextension=self.defaultextension)
filename = self.savedialog.show(initialdir=dir, initialfile=base)