Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05ef4d3

Browse files
Added missed calls of splitlist().
2 parents 7be74cf + 8381f90 commit 05ef4d3

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

Lib/tkinter/font.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def __init__(self, root=None, font=None, name=None, exists=False,
8181
if exists:
8282
self.delete_font = False
8383
# confirm font exists
84-
if self.name not in root.tk.call("font", "names"):
84+
if self.name not in root.tk.splitlist(
85+
root.tk.call("font", "names")):
8586
raise tkinter._tkinter.TclError(
8687
"named font %s does not already exist" % (self.name,))
8788
# if font config info supplied, apply it

Lib/tkinter/test/test_ttk/test_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,6 @@ def test_list_from_layouttuple(self):
407407
('name', 'no_minus', 'value'))
408408
self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
409409
('something', '-children')) # no children
410-
self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
411-
('something', '-children', 'value')) # invalid children
412410

413411

414412
def test_val_or_dict(self):

Lib/tkinter/ttk.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def _list_from_statespec(stuple):
275275
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."""
278+
ltuple = tk.splitlist(ltuple)
278279
res = []
279280

280281
indx = 0
@@ -293,8 +294,6 @@ def _list_from_layouttuple(tk, ltuple):
293294
indx += 2
294295

295296
if opt == 'children':
296-
if not tk.wantobjects():
297-
val = tk.splitlist(val)
298297
val = _list_from_layouttuple(tk, val)
299298

300299
opts[opt] = val
@@ -408,8 +407,8 @@ def map(self, style, query_opt=None, **kw):
408407
return _list_from_statespec(self.tk.splitlist(
409408
self.tk.call(self._name, "map", style, '-%s' % query_opt)))
410409

411-
return _dict_from_tcltuple(
412-
self.tk.call(self._name, "map", style, *(_format_mapdict(kw))))
410+
return _dict_from_tcltuple(self.tk.splitlist(
411+
self.tk.call(self._name, "map", style, *(_format_mapdict(kw)))))
413412

414413

415414
def lookup(self, style, option, state=None, default=None):
@@ -463,8 +462,8 @@ def layout(self, style, layoutspec=None):
463462
lspec = "null" # could be any other word, but this may make sense
464463
# when calling layout(style) later
465464

466-
return _list_from_layouttuple(self.tk, self.tk.splitlist(
467-
self.tk.call(self._name, "layout", style, lspec)))
465+
return _list_from_layouttuple(self.tk,
466+
self.tk.call(self._name, "layout", style, lspec))
468467

469468

470469
def element_create(self, elementname, etype, *args, **kw):

0 commit comments

Comments
 (0)