pygame小案例
作者:互联网
1.鼠标移动生成彩色圆形
import sys
import pygame
from random import randint
pygame.init()
screen = pygame.display.set_mode((1000,500))
pygame.display.set_caption("666")
pygame.display.flip()
while True:
event = pygame.event.wait()
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONDOWN:
mx,my = event.pos
pygame.draw.circle(screen,(255,255,0),(mx,my),50)
pygame.display.update()
elif event.type == pygame.MOUSEMOTION:
mx, my = event.pos
pygame.draw.circle(screen, (randint(0,255),randint(0,255),randint(0,255)),(mx, my), 50)
pygame.display.update()
标签:randint,event,案例,pygame,mx,display,255 来源: https://www.cnblogs.com/karl-lighting/p/pygame-1.html