turtle

画一个五角星

import turtle

def paint():
    t = turtle
    t.speed(1)
    for i in range(5):
        t.forward(100)
        t.left(72)
        print(t.pos())
        t.forward(100)
        t.right(144)
        print(t.pos())

    t.goto(180.90,-58.78)
    t.penup()
    t.goto(130.90,95.11)
    t.pendown()
    t.goto(130.90,-95.11)
    t.penup()
    t.goto(261.80,0.00)
    t.pendown()
    t.goto(80.90,-58.78)
    t.penup()
    t.goto(211.80,-153.88)
    t.pendown()
    t.goto(100.00,0.00)
    t.penup()
    t.goto(50.00,-153.88)
    t.pendown()
    t.goto(161.80,0.00)
    t.hideturtle()
    t.mainloop()

if __name__ == '__main__':
    paint()
原文地址:https://www.cnblogs.com/fashow/p/15325718.html