pygame

引言

出于个人兴趣,学习一下python的pygame

  安装

pip3 install pygame

使用pygame

Pygame有很多的模块,下面是一张一览表:

模块名功能
pygame.cdrom 访问光驱
pygame.cursors 加载光标
pygame.display 访问显示设备
pygame.draw 绘制形状、线和点
pygame.event 管理事件
pygame.font 使用字体
pygame.image 加载和存储图片
pygame.joystick 使用游戏手柄或者 类似的东西
pygame.key 读取键盘按键
pygame.mixer 声音
pygame.mouse 鼠标
pygame.movie 播放视频
pygame.music 播放音频
pygame.overlay 访问高级视频叠加
pygame 就是我们在学的这个东西了……
pygame.rect 管理矩形区域
pygame.sndarray 操作声音数据
pygame.sprite 操作移动图像
pygame.surface 管理图像和屏幕
pygame.surfarray 管理点阵图像数据
pygame.time 管理时间和帧信息
pygame.transform

缩放和移动图像

一些使用可能在一些平台上面无法使用,可以做如下测试:

if pygame.font is None:
    print("The font module is not available")
    sys.exit()

界面化

 

posted @ 2017-02-25 00:14  病毒尖er  阅读(137)  评论(0编辑  收藏  举报