先上效果图: 进入正题: 首先引入turtle和random库: import turtle as t from random import * 其次定义绘制雪花函数: def drawSnow(): t.hideturtle() t.pensize(2) for i in range(100): r,g,b = random(),random(),random() t.pencolor(r,g,b) t.penup() t.setx(randint(-350,350)) t.sety(r