summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-04-25 10:07:58 (GMT)
committerGitHub <noreply@github.com>2021-04-25 10:07:58 (GMT)
commit3bb3fb3be09d472a43cdc3d9d9578bd49f3dfb8c (patch)
tree683c7ba6c3fd9fe0899fba5254fb7a6b6193386a /Lib/tkinter
parent8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32 (diff)
downloadcpython-3bb3fb3be09d472a43cdc3d9d9578bd49f3dfb8c.zip
cpython-3bb3fb3be09d472a43cdc3d9d9578bd49f3dfb8c.tar.gz
cpython-3bb3fb3be09d472a43cdc3d9d9578bd49f3dfb8c.tar.bz2
bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs by window managers on macOS and X Window (#25187)
Diffstat (limited to 'Lib/tkinter')
-rw-r--r--Lib/tkinter/filedialog.py2
-rw-r--r--Lib/tkinter/simpledialog.py12
2 files changed, 14 insertions, 0 deletions
diff --git a/Lib/tkinter/filedialog.py b/Lib/tkinter/filedialog.py
index 3ed93eb..600d0bd 100644
--- a/Lib/tkinter/filedialog.py
+++ b/Lib/tkinter/filedialog.py
@@ -24,6 +24,7 @@ from tkinter import (
)
from tkinter.dialog import Dialog
from tkinter import commondialog
+from tkinter.simpledialog import _setup_dialog
dialogstates = {}
@@ -62,6 +63,7 @@ class FileDialog:
self.top = Toplevel(master)
self.top.title(title)
self.top.iconname(title)
+ _setup_dialog(self.top)
self.botframe = Frame(self.top)
self.botframe.pack(side=BOTTOM, fill=X)
diff --git a/Lib/tkinter/simpledialog.py b/Lib/tkinter/simpledialog.py
index a66fbd6..538bbfc 100644
--- a/Lib/tkinter/simpledialog.py
+++ b/Lib/tkinter/simpledialog.py
@@ -40,6 +40,9 @@ class SimpleDialog:
if title:
self.root.title(title)
self.root.iconname(title)
+
+ _setup_dialog(self.root)
+
self.message = Message(self.root, text=text, aspect=400)
self.message.pack(expand=1, fill=BOTH)
self.frame = Frame(self.root)
@@ -115,6 +118,8 @@ class Dialog(Toplevel):
if title:
self.title(title)
+ _setup_dialog(self)
+
self.parent = parent
self.result = None
@@ -252,6 +257,13 @@ def _place_window(w, parent=None):
w.wm_deiconify() # Become visible at the desired location
+def _setup_dialog(w):
+ if w._windowingsystem == "aqua":
+ w.tk.call("::tk::unsupported::MacWindowStyle", "style",
+ w, "moveableModal", "")
+ elif w._windowingsystem == "x11":
+ w.wm_attributes("-type", "dialog")
+
# --------------------------------------------------------------------
# convenience dialogues