RadioButton (hwx.gui)#

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

Bases: ButtonBase

A RadioButton

A RadioButton is a widget that can be switched on/off.

Attribute Table#

Name

Type

centerAlign

property

Example

from hwx import gui

# This method is called when the radio button is pushed.
def onClick(event):
enabled = "On" if event.value else "Off"
output.text = enabled

# Below, we'll create a RadioButton and a label.
# When the RadioButton is clicked, the output label
# will update to match the value of the radio button.
button = gui.RadioButton('On or Off?', command=onClick)
output = gui.Label("Off")

frame = gui.HFrame(button, 10, output)

show(frame)
property centerAlign#

Aligns the radio button at the center of the layout.