diff -r ab28676df655 Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py Mon Jul 25 02:21:14 2016 +0000 +++ b/Lib/tkinter/tix.py Mon Jul 25 06:00:56 2016 +0300 @@ -26,8 +26,10 @@ # appreciate the advantages. # +import os +import tkinter from tkinter import * -from tkinter import _cnfmerge, _default_root +from tkinter import _cnfmerge import _tkinter # If this fails your Python may not be configured for Tk @@ -68,7 +70,6 @@ TCL_ALL_EVENTS = 0 # BEWARE - this is implemented by copying some code from the Widget class # in Tkinter (to override Widget initialization) and is therefore # liable to break. -import tkinter, os # Could probably add this to Tkinter.Misc class tixCommand: @@ -471,11 +472,16 @@ class DisplayStyle: """DisplayStyle - handle configuration options shared by (multiple) Display Items""" - def __init__(self, itemtype, cnf={}, **kw): - master = _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 cnf: + master = cnf['refwindow'] + elif 'refwindow' in kw: + master = kw['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) )