擅长:python、mysql、java
<p>您<em>可以</em>使用时间模块(单击<a href="https://docs.python.org/3/library/time.html" rel="nofollow noreferrer">here</a>查看文档)。
这里有一个程序,它会打印“我是pygame中任何你做的事情的替代者!”直到启动后5秒</p>
<pre class="lang-py prettyprint-override"><code>import time
start = time.time()
seconds = 5
while not time.time() >= start + seconds:
print("I'm a replacement for whatever you do in pygame!")
print(str(seconds)," seconds is up!")
</code></pre>