ToggleButton (hwx.gui)#
- class ToggleButton(text=None, **kwds)#
Bases:
PushButton
A ToggleButton
Toggle on off the Button to command the computer to preform some action. ToggleButton is usually used in a ToolBar without text.
The ToggleButton is a specialized control that has the abilty of being selected. ToggleButtons, when clicked, display their state (selected or unselected).
Example
from hwx import gui # This method is called when the button is pushed. def onClick(event): button.text = "Un-toggle Me" if button.checked else "Toggle Me" # Create a ToggleButton, change its label when it's pushed button = gui.ToggleButton('Toggle me', command=onClick, # enabled = False, # Uncomment this disable the button # flat = True, # Uncomment this line to see a flat button # accel = "Ctrl+H", # Uncomment this add an accelerator ) show(button)