慢慢变大的小球 import pgzrun r = 1 def draw(): screen.fill('blue') screen.draw.filled_circle((400, 300), r, 'green') def update(): global r r = r+1 pgzrun.go()
import pgzrun r = 1 def draw(): screen.fill('blue') # 背景色用蓝色填充 screen.draw.filled_circle((400, 300), r, 'green') #画圆,第一个参数,位置(400,300),第二个圆半径,第三个圆颜色, def update(): # 更新画面 global r # r = r+1 if r>300: r=r-1 else: r=r+1 pgzrun.go()