Issue #27611: Fixed support of default root window in the tkinter.tix module.

This commit is contained in:
Serhiy Storchaka 2016-09-25 16:46:10 +03:00
parent 613f8e513c
commit e6f0199c19
2 changed files with 11 additions and 4 deletions

View file

@ -477,10 +477,15 @@ class DisplayStyle:
(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")
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) )