【发布时间】:2021-05-18 20:15:15
【问题描述】:
我试图在单击按钮后的某个时间阻止鼠标,所以我创建了一个函数:
import pygame
import game_cache
import time
def set_mouse_blocked(boolean, timer=False):
if boolean:
game_cache.is_mouse_active = False
if timer:
...
else:
game_cache.is_mouse_active = True
如何在没有循环的情况下完成这个功能?
附:没有机会使用循环,因为这个函数在循环中调用
【问题讨论】:
-
我在主脚本中使用了 pygame 模块——这个文件只是所有项目的一部分。 timer 参数是以秒为单位的阻塞时间
标签: python python-3.x time pygame