用户:伦敦西区肯辛顿富人区名富商大天才煊查看:1 回复:5 评论:1 创建时间:2019-02-25T18:57:18
import random
import turtle
t = turtle.Pen()
colors = ['red', 'blue', 'yellow', 'pink', 'green', 'purple', 'orange', 'white']
t.speed(1000)
turtle.bgcolor("black")
def paintbrush(x,y):
a = random.randint(0, 7)
b = random.randint(0, 50)
t.pencolor(colors[a])
t.fillcolor(colors[a])
t.penup()
t.goto(x, y)
t.pendown()
t.begin_fill()
t.circle(b)
t.end_fill()
turtle.onscreenclick(paintbrush)