turtleによるグラフィックス



五角形
# turtle graphics (draw of a pentagon)

import turtle as t

t.color('blue')
t.bgcolor('lightcyan')

t.shape('turtle')
t.shapesize(4)

t.penup()
t.width(10)
t.setpos(0,0)
t.setheading(0)
t.pendown()
n=5
for i in range(n):
    t.forward(200)
    t.left(360/n)

t.penup()
t.setpos (-100,-100)
t.color("red")
t.setheading(90)

戻る