Stopwatch between mouse up/down
问题 I am trying to test the time between mouse down and mouse up events by using a simple stopwatch in a while loop. The mouse down event works fine, but when i release the mouse for mouse up, the seconds continue to go up and do not stop. from pygame import * import time screen = display.set_mode((160, 90)) sec = 0 while True: new_event = event.poll() if new_event.type == MOUSEBUTTONDOWN: while True: # Basic stopwatch started time.sleep(1) sec += 1 print(sec) # In loop, when mouse button