Python Forum
Help to make a shuffleboard scoreboard
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to make a shuffleboard scoreboard
#2
Please wrap code in Python tags.

app.exec_() blocks program execution until the GUI is closed.

sys.exit(app.exec_()) exits the program as soon as this happens.

This is never executed:
button1 = Button(2)
button2 = Button(3)
button3 = Button(4)

while True:
    if button3.is_pressed:
        count += 1
        sleep(0.4)
    if button1.is_pressed:
        count1 += 1
        sleep(0.4)
    elif button2.is_pressed:
        count = 0
        count1 = 0
Read up on QTimer to see how you can run your GUI and run your hardware code simultaneously.

Using a sleep(0.4) to prevent a button press from being counted as multiple presses is not reliable. You never want to use the sleep() command in a gui application. It makes the GUI unresponsive.
Reply


Messages In This Thread
Help to make a shuffleboard scoreboard - by Slett1 - Apr-28-2022, 05:20 PM
RE: Help to make a shuffleboard scoreboard - by deanhystad - Apr-28-2022, 06:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Object of type Scoreboard is not JSON serializable lsepolis123 9 9,528 Aug-13-2019, 11:22 AM
Last Post: lsepolis123

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020