【文件属性】:
文件名称:pygame学习笔记(2):画点的三种方法和动画实例
文件大小:82KB
文件格式:PDF
更新时间:2020-12-24 06:42:16
event pygame 动画
1、单个像素(画点)
利用pygame画点主要有三种方法:
方法一:画长宽为1个像素的正方形
复制代码 代码如下:
import pygame,sys
pygame.init()
screen=pygame.display.set_caption(‘hello world!’)
screen=pygame.display.set_mode([640,480])
screen.fill([255,255,255])
pygame.draw.rect(screen,[0,0,0],[150,50,1,1],1) #画1*1的矩形,线宽为1,这里不能是0,因为1*1无空白区域。
pygame.dis