diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-01-22 09:17:38 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-01-22 09:17:38 (GMT) |
commit | 70c3dda2fba35f08f32163bc03315834d165cb36 (patch) | |
tree | 4d12fdde3bbb1fd84c245b204b7af37bbbba813d /Lib/lib-tk | |
parent | d7ceb222bd19ea25b0b4d234623df0a9f73c96b5 (diff) | |
download | cpython-70c3dda2fba35f08f32163bc03315834d165cb36.zip cpython-70c3dda2fba35f08f32163bc03315834d165cb36.tar.gz cpython-70c3dda2fba35f08f32163bc03315834d165cb36.tar.bz2 |
Convert booleans to integers in IntVar.set. Fixes #671741.
Return booleans from _tkinter.getboolean.
Convert booleans to Tcl booleans in AsObj.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index de41bdc..bd80c3b 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -234,6 +234,12 @@ class IntVar(Variable): MASTER can be given as master widget.""" Variable.__init__(self, master) + def set(self, value): + """Set the variable to value, converting booleans to integers.""" + if isinstance(value, bool): + value = int(value) + return Variable.set(self, value) + def get(self): """Return the value of the variable as an integer.""" return getint(self._tk.globalgetvar(self._name)) |