pygame中的.quit和.QUIT有什么区别 [英] What is the difference between .quit and .QUIT in pygame
本文介绍了pygame中的.quit和.QUIT有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想知道pygame中.quit
和.QUIT
的区别.我已经测试了两者,但我仍然不明白它们是如何工作的.
I just want to know the difference between .quit
and .QUIT
in pygame. I've tested both but I continue to not understand how they work.
推荐答案
QUIT
是事件类型的枚举常量(参见 event
模块).pygame 窗口关闭时会发生退出事件:
QUIT
is the enumerator constant for an event type (see event
module). The quit event occurs when the pygame window is closed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
# [...]
quit()
是一个取消初始化所有 pygame 模块的函数.这个函数应该在应用程序结束时调用:
quit()
is a function which uninitialize all pygame modules. This function should be called at the end of the applicaiition:
# initialize all imported pygame modules
pygame.init()
# application loop
while True:
# [...]
# uninitialize all pygame modules
pygame.quit()
这篇关于pygame中的.quit和.QUIT有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文