import turtle
import random
def star():
for i in range(5):
turtle.fd(100)
turtle.left(144)
def color():
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
turtle.color(r / 255, g / 255, b / 255)
def go():
a = random.randint(-350,350)
# 抬笔 up
turtle.penup()
# 跳转 goto 加一个随机坐标
b = random.randint(-350, 350)
turtle.goto(a,b)
turtle.pendown() # down落下 done完成
turtle.width(10)
turtle.speed(0)
for i in range(100):
color()
# star()
text = ["鸡你太美","唱"]
turtle.write(text[random.randint(0,1)],font=(None, random.randint(10,40)))
go()
turtle.done()`
xinixn- 学习函数
最新推荐文章于 2021-10-15 18:18:41 发布