PushButton (hwx.gui)#

class PushButton(text=None, **kwds)#

Bases: ButtonBase

A PushButton.

Push the button to command the computer to preform some action.

The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Typical buttons are OK, Apply, Cancel, Close, Yes, No and Help.

Example

from hwx import gui

# This method is called when the button is pushed.
def onClick(event):
gui.tellUser("Hello World")

# This PushButton, when clicked, pops up an information message
button = gui.PushButton('Say Hello',
#  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
command=onClick, )

# Set the properties outside the constructor
# button.flat    = True
# button.enabled = False
# button.accel   = "Ctrl+H"

show(button)