How to freeze pygame window?
问题 When I want to freeze my pygame window for a few seconds I usually use time.sleep(). However, if I accidentaly press any key on my keyboard meanwhile it detects the key after the time has passed. Is there any way to freeze my pygame window so that the code won’t consider the key pressed? 回答1: Here is an example where the screen will change color every frame. The title bar displays the last key pressed. If the space bar is pressed, the color change is paused for three seconds. Key presses are