MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / BooleanVar

Class BooleanVar

tools/python-3.11.9-amd64/Lib/tkinter/__init__.py:618–645  ·  view source on GitHub ↗

Value holder for boolean variables.

Source from the content-addressed store, hash-verified

616
617
618class BooleanVar(Variable):
619 """Value holder for boolean variables."""
620 _default = False
621
622 def __init__(self, master=None, value=None, name=None):
623 """Construct a boolean variable.
624
625 MASTER can be given as master widget.
626 VALUE is an optional value (defaults to False)
627 NAME is an optional Tcl name (defaults to PY_VARnum).
628
629 If NAME matches an existing variable and VALUE is omitted
630 then the existing value is retained.
631 """
632 Variable.__init__(self, master, value, name)
633
634 def set(self, value):
635 """Set the variable to VALUE."""
636 return self._tk.globalsetvar(self._name, self._tk.getboolean(value))
637
638 initialize = set
639
640 def get(self):
641 """Return the value of the variable as a bool."""
642 try:
643 return self._tk.getboolean(self._tk.globalgetvar(self._name))
644 except TclError:
645 raise ValueError("invalid literal for getboolean()")
646
647
648def mainloop(n=0):

Callers 15

test_defaultMethod · 0.90
test_getMethod · 0.90
test_setMethod · 0.90
create_page_fontMethod · 0.90
create_page_highlightMethod · 0.90
create_page_keysMethod · 0.90
create_page_windowsMethod · 0.90
create_page_shedMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
create_extraMethod · 0.90

Calls

no outgoing calls

Tested by 6

test_defaultMethod · 0.72
test_getMethod · 0.72
test_setMethod · 0.72
setUpClassMethod · 0.72
test_find_againMethod · 0.72