# Write your code here :-)
from guizero import App, Text, PushButton, Slider
import serial

ser = serial.Serial('/dev/ttyACM0',9600)
scoreArduino = 1 # set to 1 to ensure Arduino is updating score variable

def start_game():
    startGameMsg.value = "Begin!"

def update_score():
    scoreGame.value = "Score: " + str(int(ser.readline()))

# create root program interface
app = App(title="Fab Academy Pinball Machine")

intro = Text(app, text="Welcome to our Fab(ulous) Pinball Machine!")
startGame = PushButton(app, text="START", command=start_game)
startGameMsg = Text(app)
scoreGame = Text(app)
scoreGame.repeat(100, update_score)
app.display()