summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-19 16:35:10 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-19 16:35:10 (GMT)
commit22234dab05f69fbbe2f906ab58f5abc95382f680 (patch)
tree4b04706ed3d5ffea7daaac1e6df158a9823fc9be /Lib/tkinter
parent2d01c0a08033fb1f10a648135372d857d3f5d6ca (diff)
parente95977621de92f99153d48d2c4dde9cbdff6e3a7 (diff)
downloadcpython-22234dab05f69fbbe2f906ab58f5abc95382f680.zip
cpython-22234dab05f69fbbe2f906ab58f5abc95382f680.tar.gz
cpython-22234dab05f69fbbe2f906ab58f5abc95382f680.tar.bz2
Fixed grid_columnconfigure() and grid_rowconfigure() methods of
Tkinter widgets to work in wantobjects=True mode.
Diffstat (limited to 'Lib/tkinter')
-rw-r--r--Lib/tkinter/__init__.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index d7352ea..5d6f31b 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1339,6 +1339,21 @@ class Misc:
args = args + (col2, row2)
return self._getints(self.tk.call(*args)) or None
bbox = grid_bbox
+
+ def _gridconvvalue(self, value):
+ if isinstance(value, (str, _tkinter.Tcl_Obj)):
+ try:
+ svalue = str(value)
+ if not svalue:
+ return None
+ elif '.' in svalue:
+ return getdouble(svalue)
+ else:
+ return getint(svalue)
+ except ValueError:
+ pass
+ return value
+
def _grid_configure(self, command, index, cnf, kw):
"""Internal function."""
if isinstance(cnf, str) and not kw:
@@ -1357,22 +1372,14 @@ class Misc:
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[i+1]
- if not value:
- value = None
- elif '.' in str(value):
- value = getdouble(value)
- else:
- value = getint(value)
- dict[key] = value
+ dict[key] = self._gridconvvalue(value)
return dict
res = self.tk.call(
('grid', command, self._w, index)
+ options)
if len(options) == 1:
- if not res: return None
- # In Tk 7.5, -width can be a float
- if '.' in res: return getdouble(res)
- return getint(res)
+ return self._gridconvvalue(res)
+
def grid_columnconfigure(self, index, cnf={}, **kw):
"""Configure column INDEX of a grid.