From b82e7cc3b9978bf78a34a6e38e20d12df9bc9a22 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 16 Oct 2026 12:41:48 +0200 Subject: [PATCH] [3.15] gh-159517: Modernize tkinter.simpledialog (GH-159518) gh-159517: Modernize tkinter.simpledialog No longer call ::tk::unsupported::MacWindowStyle on Tcl 9.1 and newer. (cherry picked from commit 173dabeab84a5f4575d9d599f811280a4a8409d3) Co-authored-by: Victor Stinner Co-authored-by: Serhiy Storchaka --- Lib/tkinter/simpledialog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/tkinter/simpledialog.py b/Lib/tkinter/simpledialog.py index 81edd77e0bd2446..2df946ea504f456 100644 --- a/Lib/tkinter/simpledialog.py +++ b/Lib/tkinter/simpledialog.py @@ -259,8 +259,11 @@ def _place_window(w, parent=None): def _setup_dialog(w): if w._windowingsystem == "aqua": - w.tk.call("::tk::unsupported::MacWindowStyle", "style", - w, "moveableModal", "") + if w.info_patchlevel() >= (9, 1): + w.wm_attributes(stylemask='titled') + else: + w.tk.call('::tk::unsupported::MacWindowStyle', 'style', + w, 'moveableModal', '') elif w._windowingsystem == "x11": w.wm_attributes(type="dialog")