File: button_group.py

package info (click to toggle)
python-guizero 1.1.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,676 kB
  • sloc: python: 6,286; makefile: 28; sh: 17
file content (15 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()