summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/__init__.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-04 09:44:30 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-04 09:44:30 (GMT)
commit06e66108c6c71e1cc2b6a0c1d4cd8d245469632f (patch)
tree538f1b9c7cb6dd16720000b232038d17ad0f3dbd /Lib/tkinter/__init__.py
parent46ba6c8563922f043cad6423202ee0119614c807 (diff)
parent9a6e201f7d5f147b776274c1598089fc68859e98 (diff)
downloadcpython-06e66108c6c71e1cc2b6a0c1d4cd8d245469632f.zip
cpython-06e66108c6c71e1cc2b6a0c1d4cd8d245469632f.tar.gz
cpython-06e66108c6c71e1cc2b6a0c1d4cd8d245469632f.tar.bz2
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.
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r--Lib/tkinter/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index beb0a73..c8d8061 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -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: