mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs by window managers on macOS and X Window (#25187)
This commit is contained in:
parent
8cc3cfa8af
commit
3bb3fb3be0
7 changed files with 25 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue