《 python和pygame游戏开发指南》-(1)pygame的测试
2020-03-23 15:38 作者:一心想当网红的李老师 | 我要投稿
本来去学校是去借wxpython的书,这样省的自己网上到处收索。结果不知道为什么没有。只看见了一本pygame的书。
想想pygame既然可以做游戏,应该也可以满足我的需要。
先尝试了一下。pip install pygame
结果发现python(x,y)(2.7版本)里面本来就有。
anaconda里面怎么也执行不了这个命令,主要是pygame的官网丢了。
执行pip install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple 成功(这个是国内清华的镜像,很多扩展包都有)
import sys
import pygame
from pygame.locals import *
pygame.init()
Win=pygame.display.set_mode((720,480))
pygame.display.set_caption('first try')
while True:
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
调试成功,但是完全不能理解pygame.quit()和sys.exit()的区别。
调试结果也有警告提示。