summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/tkinter/tix.py16
-rw-r--r--Misc/NEWS3
2 files changed, 14 insertions, 5 deletions
diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py
index 04465aa4d7..f3eb92e122 100644
--- a/Lib/tkinter/tix.py
+++ b/Lib/tkinter/tix.py
@@ -472,11 +472,17 @@ class DisplayStyle:
"""DisplayStyle - handle configuration options shared by
(multiple) Display Items"""
- def __init__(self, itemtype, cnf={}, **kw):
- master = tkinter._default_root # global from Tkinter
- if not master and 'refwindow' in cnf: master=cnf['refwindow']
- elif not master and 'refwindow' in kw: master= kw['refwindow']
- elif not master: raise RuntimeError("Too early to create display style: no root window")
+ def __init__(self, itemtype, cnf={}, *, master=None, **kw):
+ if not master:
+ if 'refwindow' in kw:
+ master = kw['refwindow']
+ elif 'refwindow' in cnf:
+ master = cnf['refwindow']
+ else:
+ master = tkinter._default_root
+ if not master:
+ raise RuntimeError("Too early to create display style: "
+ "no root window")
self.tk = master.tk
self.stylename = self.tk.call('tixDisplayStyle', itemtype,
*self._options(cnf,kw) )
diff --git a/Misc/NEWS b/Misc/NEWS
index e9b22be114..7b38dfd6f3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -41,6 +41,9 @@ Core and Builtins
Library
-------
+- Issue #27611: Fixed support of default root window in the tkinter.tix module.
+ Added the master parameter in the DisplayStyle constructor.
+
- Issue #27348: In the traceback module, restore the formatting of exception
messages like "Exception: None". This fixes a regression introduced in
3.5a2.