mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +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
|
@ -28,6 +28,7 @@ from tkinter import Toplevel, StringVar, BooleanVar, W, E, S
|
|||
from tkinter.ttk import Frame, Button, Entry, Label, Checkbutton
|
||||
from tkinter import filedialog
|
||||
from tkinter.font import Font
|
||||
from tkinter.simpledialog import _setup_dialog
|
||||
|
||||
class Query(Toplevel):
|
||||
"""Base class for getting verified answer from a user.
|
||||
|
@ -60,13 +61,8 @@ class Query(Toplevel):
|
|||
if not _utest: # Otherwise fail when directly run unittest.
|
||||
self.grab_set()
|
||||
|
||||
windowingsystem = self.tk.call('tk', 'windowingsystem')
|
||||
if windowingsystem == 'aqua':
|
||||
try:
|
||||
self.tk.call('::tk::unsupported::MacWindowStyle', 'style',
|
||||
self._w, 'moveableModal', '')
|
||||
except:
|
||||
pass
|
||||
_setup_dialog(self)
|
||||
if self._windowingsystem == 'aqua':
|
||||
self.bind("<Command-.>", self.cancel)
|
||||
self.bind('<Key-Escape>', self.cancel)
|
||||
self.protocol("WM_DELETE_WINDOW", self.cancel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue