mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always
returns bool. tkinter.BooleanVar now validates input values (accepted bool, int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns bool.
This commit is contained in:
commit
06e66108c6
6 changed files with 58 additions and 17 deletions
|
@ -391,6 +391,11 @@ class BooleanVar(Variable):
|
|||
"""
|
||||
Variable.__init__(self, master, value, name)
|
||||
|
||||
def set(self, value):
|
||||
"""Set the variable to VALUE."""
|
||||
return self._tk.globalsetvar(self._name, self._tk.getboolean(value))
|
||||
initialize = set
|
||||
|
||||
def get(self):
|
||||
"""Return the value of the variable as a bool."""
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue