@@ -272,7 +272,7 @@ def _list_from_statespec(stuple):
272272 it = iter (nval )
273273 return [_flatten (spec ) for spec in zip (it , it )]
274274
275- def _list_from_layouttuple (ltuple ):
275+ def _list_from_layouttuple (tk , ltuple ):
276276 """Construct a list from the tuple returned by ttk::layout, this is
277277 somewhat the reverse of _format_layoutlist."""
278278 res = []
@@ -293,32 +293,29 @@ def _list_from_layouttuple(ltuple):
293293 indx += 2
294294
295295 if opt == 'children' :
296- if (tkinter ._default_root and
297- not tkinter ._default_root .wantobjects ()):
298- val = tkinter ._default_root .splitlist (val )
299- val = _list_from_layouttuple (val )
296+ if not tk .wantobjects ():
297+ val = tk .splitlist (val )
298+ val = _list_from_layouttuple (tk , val )
300299
301300 opts [opt ] = val
302301
303302 return res
304303
305- def _val_or_dict (options , func , * args ):
306- """Format options then call func with args and options and return
304+ def _val_or_dict (tk , options , * args ):
305+ """Format options then call Tk command with args and options and return
307306 the appropriate result.
308307
309308 If no option is specified, a dict is returned. If a option is
310309 specified with the None value, the value for that option is returned.
311310 Otherwise, the function just sets the passed options and the caller
312311 shouldn't be expecting a return value anyway."""
313312 options = _format_optdict (options )
314- res = func (* (args + options ))
313+ res = tk . call (* (args + options ))
315314
316315 if len (options ) % 2 : # option specified without a value, return its value
317316 return res
318317
319- if tkinter ._default_root :
320- res = tkinter ._default_root .splitlist (res )
321- return _dict_from_tcltuple (res )
318+ return _dict_from_tcltuple (tk .splitlist (res ))
322319
323320def _convert_stringval (value ):
324321 """Converts a value to, hopefully, a more appropriate Python object."""
@@ -396,7 +393,7 @@ def configure(self, style, query_opt=None, **kw):
396393 a sequence identifying the value for that option."""
397394 if query_opt is not None :
398395 kw [query_opt ] = None
399- return _val_or_dict (kw , self .tk . call , self ._name , "configure" , style )
396+ return _val_or_dict (self .tk , kw , self ._name , "configure" , style )
400397
401398
402399 def map (self , style , query_opt = None , ** kw ):
@@ -466,7 +463,7 @@ def layout(self, style, layoutspec=None):
466463 lspec = "null" # could be any other word, but this may make sense
467464 # when calling layout(style) later
468465
469- return _list_from_layouttuple (self .tk .splitlist (
466+ return _list_from_layouttuple (self .tk , self . tk .splitlist (
470467 self .tk .call (self ._name , "layout" , style , lspec )))
471468
472469
@@ -907,7 +904,7 @@ def tab(self, tab_id, option=None, **kw):
907904 options to the corresponding values."""
908905 if option is not None :
909906 kw [option ] = None
910- return _val_or_dict (kw , self .tk . call , self ._w , "tab" , tab_id )
907+ return _val_or_dict (self .tk , kw , self ._w , "tab" , tab_id )
911908
912909
913910 def tabs (self ):
@@ -984,7 +981,7 @@ def pane(self, pane, option=None, **kw):
984981 Otherwise, sets the options to the corresponding values."""
985982 if option is not None :
986983 kw [option ] = None
987- return _val_or_dict (kw , self .tk . call , self ._w , "pane" , pane )
984+ return _val_or_dict (self .tk , kw , self ._w , "pane" , pane )
988985
989986
990987 def sashpos (self , index , newpos = None ):
@@ -1223,7 +1220,7 @@ def column(self, column, option=None, **kw):
12231220 Otherwise, sets the options to the corresponding values."""
12241221 if option is not None :
12251222 kw [option ] = None
1226- return _val_or_dict (kw , self .tk . call , self ._w , "column" , column )
1223+ return _val_or_dict (self .tk , kw , self ._w , "column" , column )
12271224
12281225
12291226 def delete (self , * items ):
@@ -1282,7 +1279,7 @@ def heading(self, column, option=None, **kw):
12821279 if option is not None :
12831280 kw [option ] = None
12841281
1285- return _val_or_dict (kw , self .tk . call , self ._w , 'heading' , column )
1282+ return _val_or_dict (self .tk , kw , self ._w , 'heading' , column )
12861283
12871284
12881285 def identify (self , component , x , y ):
@@ -1361,7 +1358,7 @@ def item(self, item, option=None, **kw):
13611358 values as given by kw."""
13621359 if option is not None :
13631360 kw [option ] = None
1364- return _val_or_dict (kw , self .tk . call , self ._w , "item" , item )
1361+ return _val_or_dict (self .tk , kw , self ._w , "item" , item )
13651362
13661363
13671364 def move (self , item , parent , index ):
@@ -1456,7 +1453,7 @@ def tag_configure(self, tagname, option=None, **kw):
14561453 values for the given tagname."""
14571454 if option is not None :
14581455 kw [option ] = None
1459- return _val_or_dict (kw , self .tk . call , self ._w , "tag" , "configure" ,
1456+ return _val_or_dict (self .tk , kw , self ._w , "tag" , "configure" ,
14601457 tagname )
14611458
14621459
0 commit comments