Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/idlelib/config_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tkinter import Toplevel, Listbox, StringVar, TclError
from tkinter.ttk import Frame, Button, Checkbutton, Entry, Label, Scrollbar
from tkinter import messagebox
from tkinter.simpledialog import _setup_dialog
import string
import sys

Expand Down Expand Up @@ -63,6 +64,7 @@ def __init__(self, parent, title, action, current_key_sequences,
self.resizable(height=False, width=False)
self.title(title)
self.transient(parent)
_setup_dialog(self)
self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.cancel)
self.parent = parent
Expand Down
10 changes: 3 additions & 7 deletions Lib/idlelib/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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.
Expand Down Expand Up @@ -60,13 +61,8 @@ def __init__(self, parent, title, message, *, text0='', used_names={},
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)
Expand Down
2 changes: 2 additions & 0 deletions Lib/idlelib/searchbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from tkinter import Toplevel
from tkinter.ttk import Frame, Entry, Label, Button, Checkbutton, Radiobutton
from tkinter.simpledialog import _setup_dialog


class SearchDialogBase:
Expand Down Expand Up @@ -83,6 +84,7 @@ def create_widgets(self):
top.protocol("WM_DELETE_WINDOW", self.close)
top.wm_title(self.title)
top.wm_iconname(self.icon)
_setup_dialog(top)
self.top = top
self.frame = Frame(top, padding="5px")
self.frame.grid(sticky="nwes")
Expand Down
2 changes: 2 additions & 0 deletions Lib/tkinter/filedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)
from tkinter.dialog import Dialog
from tkinter import commondialog
from tkinter.simpledialog import _setup_dialog


dialogstates = {}
Expand Down Expand Up @@ -62,6 +63,7 @@ def __init__(self, master, title=None):
self.top = Toplevel(master)
self.top.title(title)
self.top.iconname(title)
_setup_dialog(self.top)
Comment thread
serhiy-storchaka marked this conversation as resolved.

self.botframe = Frame(self.top)
self.botframe.pack(side=BOTTOM, fill=X)
Expand Down
12 changes: 12 additions & 0 deletions Lib/tkinter/simpledialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def __init__(self, master,
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)
Expand Down Expand Up @@ -115,6 +118,8 @@ def __init__(self, parent, title = None):
if title:
self.title(title)

_setup_dialog(self)

self.parent = parent

self.result = None
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IDLE dialog windows are now recognized as dialogs by window managers on
macOS and X Window.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:mod:`tkinter` dialog windows are now recognized as dialogs by window
managers on macOS and X Window.