diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-25 14:36:43 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-25 14:36:43 (GMT) |
commit | 81d2be958035f70eafb73ae7207203814ad2e9ee (patch) | |
tree | eac028a4ea7cfc24a46b5348bc4ca96d4882a1d5 /Lib/tkinter/__init__.py | |
parent | a7a4b4916fa0df4edd5fdde2d235b874cf5ea181 (diff) | |
parent | 848972cac1d8a1d5a8828c807dbdaa26c2567b2c (diff) | |
download | cpython-81d2be958035f70eafb73ae7207203814ad2e9ee.zip cpython-81d2be958035f70eafb73ae7207203814ad2e9ee.tar.gz cpython-81d2be958035f70eafb73ae7207203814ad2e9ee.tar.bz2 |
Issue #19020: Tkinter now uses splitlist() instead of split() in configure
methods.
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r-- | Lib/tkinter/__init__.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 22a41ac..68cf1b3 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -1235,6 +1235,19 @@ class Misc: exc, val, tb = sys.exc_info() root = self._root() root.report_callback_exception(exc, val, tb) + + def _getconfigure(self, *args): + """Call Tcl configure command and return the result as a dict.""" + cnf = {} + for x in self.tk.splitlist(self.tk.call(*args)): + x = self.tk.splitlist(x) + cnf[x[0][1:]] = (x[0][1:],) + x[1:] + return cnf + + def _getconfigure1(self, *args): + x = self.tk.splitlist(self.tk.call(*args)) + return (x[0][1:],) + x[1:] + def _configure(self, cmd, cnf, kw): """Internal function.""" if kw: @@ -1242,15 +1255,9 @@ class Misc: elif cnf: cnf = _cnfmerge(cnf) if cnf is None: - cnf = {} - for x in self.tk.split( - self.tk.call(_flatten((self._w, cmd)))): - cnf[x[0][1:]] = (x[0][1:],) + x[1:] - return cnf + return self._getconfigure(_flatten((self._w, cmd))) if isinstance(cnf, str): - x = self.tk.split( - self.tk.call(_flatten((self._w, cmd, '-'+cnf)))) - return (x[0][1:],) + x[1:] + return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf))) self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) # These used to be defined in Widget: def configure(self, cnf=None, **kw): @@ -1271,7 +1278,7 @@ class Misc: def keys(self): """Return a list of all resource names of this widget.""" return [x[0][1:] for x in - self.tk.split(self.tk.call(self._w, 'configure'))] + self.tk.splitlist(self.tk.call(self._w, 'configure'))] def __str__(self): """Return the window path name of this widget.""" return self._w @@ -3786,16 +3793,10 @@ class PanedWindow(Widget): """ if cnf is None and not kw: - cnf = {} - for x in self.tk.split( - self.tk.call(self._w, - 'paneconfigure', tagOrId)): - cnf[x[0][1:]] = (x[0][1:],) + x[1:] - return cnf + return self._getconfigure(self._w, 'paneconfigure', tagOrId) if isinstance(cnf, str) and not kw: - x = self.tk.split(self.tk.call( - self._w, 'paneconfigure', tagOrId, '-'+cnf)) - return (x[0][1:],) + x[1:] + return self._getconfigure1( + self._w, 'paneconfigure', tagOrId, '-'+cnf) self.tk.call((self._w, 'paneconfigure', tagOrId) + self._options(cnf, kw)) paneconfig = paneconfigure |