Jun-09-2019, 05:09 PM
I am trying to make a CPS counter, you will press a button and the timer starts then it will record your CPS and display it at the end of the second.
My trouble is the timer, time.sleep() doesn't work as that would stop everything, so I need a simple timer.
Here is the code so far.
My trouble is the timer, time.sleep() doesn't work as that would stop everything, so I need a simple timer.
Here is the code so far.
import turtle cps = 0 #is the CPS goes up when seconddone = False and sets to 0 when seconddone = True seconddone = True #tells when the timer starts wn = turtle.Screen() wn.setup(width=200, height=200) wn.bgcolor("white") cpsb = turtle.Turtle() cpsb.shape("square") cpsb.color("black") cpsb.goto(0,0) def start(): seconddone = False def click(): cps = cps + 1 wn.onscreenclick(click, 1) wn.onscreenclick(start, 3) wn.onkeypress() wn.listen() while True: wn.update() while seconddone: cps = 0if anyone could help with making a timer that would be great (note I dont want to optimize the code at this point)