Python(十四)——turtle画同心圆

Python(十四)——turtle画同心圆

import turtle
t = turtle.Pen()
my_colors = ("red", "green", "yellow", "black")
t.width = 1 #设置线条的宽度
t.speed(0) #速度
for i in range(10):
    t.penup() #抬起
    t.goto(0,-10*i)
    t.pendown() #落下
    t.color(my_colors[i%len(my_colors)])
    t.circle(10+i*10)

turtle.done() #程序结束后,窗口依然在

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/zxq6661/article/details/113143181