python turtle库绘制太阳花代码

python turtle库绘制太阳花代码_第1张图片

import turtle as t
import time
t.screensize(canvwidth=None, canvheight=None, bg=None)
t.setup(width=0.5, height=0.75, startx=None, starty=None)
t.penup()
t.left(-90)
t.fd(-50)
t.left(90)
t.fd(-150)
t.speed(10)
t.begin_fill()

while True:
    t.color('red')
    t.pensize(2)
    t.pendown()
    t.fd(300)
    t.pensize(5)
    t.right(170)
    print(t.distance(-150,-50))
    if int(t.distance(-150,-50))==100:
        break
t.fillcolor('yellow')
t.end_fill()
t.done()

想要了解跟多关于python,关注我吧!

你可能感兴趣的:(turtle,python)