没什么好大的改动,如下:
import turtle
def Draw_Word(t, familyt, n):
colors = ["red", "yellow", "blue", "green", "orange",
"purple", "white", "brown ", "gray", "pink"]
for x in range(n):
t.pencolor(colors[x % len(familyt)]) # Rotate through the colors
t.penup()#Don't draw the regular spiral lines
t.forward(x*4)
# Just move the turtle on the screen
t.pendown()
# Draw the next family member's name
t.write(familyt[x % len(familyt)], font = ("Arial", int((x + 4) / 4), "bold"))
t.left(360 / len(familyt) + 2) # Turn left for our spiral
t = turtle.Pen()
turtle.bgcolor("black")
family = []
while True:
name = turtle.textinput("My family",
"Enter a name,or just hit [ENTER] to end: ")
if name == "":
break
family.append(name)
if family:
Draw_Word(t, family, 100)