def test_append(): a = App() b = ButtonGroup(a, [["foo", "f"], ["bar", "b"]]) assert b.options == [["foo", "f"], ["bar", "b"]] b.append("car") assert b.options == [["foo", "f"], ["bar", "b"], ["car", "car"]] b.append(["lah", "l"]) assert b.options == [["foo", "f"], ["bar", "b"], ["car", "car"], ["lah", "l"]] a.destroy()
font="Helvetica", color="Black", align="top") ConnectButton = PushButton(BottomBox, text="Connect", command=connectMidi, width="fill") DisconnectButton = PushButton(BottomBox, text="Disconnect All", command=disconnectMidi, width="fill") midisource = ButtonGroup(LeftBox, command=changeSource, align="left") mididestination = ButtonGroup(RightBox, command=changeDestination, align="right") for x in range(0, len(clients)): row = [] row.append(names[x]) row.append(clients[x]) midisource.append(row) for x in range(0, len(clients)): row = [] row.append(names[x]) row.append(clients[x]) mididestination.append(row) app.display()
from guizero import App, ButtonGroup def selected(): print(choice.value + " " + choice2.value) app = App() choice = ButtonGroup(app, options=["cheese", "ham", "salad"], command=selected) # You can use specific values for the button group by passing them as a 2d list. # choice = ButtonGroup(app, options=[["cheese", "c"], ["ham", "h"], ["salad", "s"]], selected="h", command=selected) choice2 = ButtonGroup(app, command=selected) choice2.append("sandwich") choice2.append("salad") app.display()