mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
d7ceb222bd
commit
70c3dda2fb
2 changed files with 9 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue