VRadioButtons (hwx.gui)#

class VRadioButtons(values, value=0, **kwds)#

Bases: RadioButtons

Group of mutually exclusive RadioButtons layed out verically.

Example

from hwx import gui

# This method is called when the any radio button is pushed.
def onSelected(event):
  output.text = event.value

# These values are a list of tuples. Each entry is a (value, text)
# The value is what is used by the value property.
# The text is what is displayed to the user.
colors = (("red", "Red"), ("green", "Green"), ("blue", "Blue"),)

# Create a Vertical layout of RadioButtons and a label to show its value
# Try replacing VRadioButtons with HRadioButtons or ComboBox
buttons = gui.VRadioButtons(colors,
  # value  ="green",   #Uncomment this to set the initial value
  command=onSelected, )
output = gui.Label(buttons.value)

frame = gui.HFrame(buttons, 10, (output, "<->"), spacing=5)

show(frame)