"""pygame简易画板练习程序,这个画板只是在image上画圆形,鼠标移动太快的话会形成散列点。
解决方案是用线性插值插入点进去即可,读者可自行改进。"""
import pygame
from pygame.locals import *
def main():
pygame.init()
screenWidth,screenHeight=480,360
screen = pygame.display.set_mode((screenWidth,screenHeight))
pygame.display.set_caption("python简易画板_作者:李兴球")
画板 = pygame.image.load("画板.png")
pen = Pen((255,0,0),2)
clock = pygame.time.Clock()
运行中 = True
while 运行中:
for event in pygame.event.get():
if event.type==QUIT:运行中=False
if event.type == MOUSEBUTTONDOWN:
pen.status = 1
if event.type ==MOUSEBUTTONUP:
pen.status =0
pygame.quit()
if __name__=="__main__":
main()
如需要查看完整代码,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)

