Convert booleans to integers in IntVar.set. Fixes #671741.

Return booleans from _tkinter.getboolean.
Convert booleans to Tcl booleans in AsObj.
This commit is contained in:
Martin v. Löwis 2003-01-22 09:17:38 +00:00
parent d7ceb222bd
commit 70c3dda2fb
2 changed files with 9 additions and 1 deletions

View file

@ -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))