慢慢地画一个个的圆圈程序。下面是部分代码预览:
""" pygame控制鼠标坐标不断画一个彩色圆圈演示程序.py 结束程序请按任意键。 """ import math import pygame from pygame.locals import * from random import randint angle = 0 radius = 100 color = (255,0,0) width,height = 480,360 wc,hc = width//2,height//2 # 屏幕中心点坐标 screen = pygame.display.set_mode((width,height)) image = pygame.Surface((width,height)) clock = pygame.time.Clock() running = True while running: ....................... angle = angle + 1 if angle % 360 ==0 : image.fill((0,0,0)) color = randint(0,255),randint(0,255),randint(0,255) angle = 0 clock.tick(60) pygame.quit()
如需要查看完整源代码,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)