File: button_value.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 (14 lines) | stat: -rw-r--r-- 327 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from guizero import App, Text, PushButton

def show_button_state():
    if button.value:
        button_state.value = "pressed"
    else:
        button_state.value = "released"

app = App()
button = PushButton(app)
button_state = Text(app)
# continually update the button state
app.repeat(50, show_button_state)
app.display()