Python —— turtle 绘图

用 turtle 画滑板!

 

代码:

import turtle as t
t.speed(0)

t.pensize(3)
t.fillcolor('#fbc55b')
t.begin_fill()

t.penup()
t.goto(80,-60)
t.pendown()
t.left(170)
t.forward(250)
t.right(18)
t.circle(-200,10)
t.right(20)
t.circle(-30,100)
t.circle(-70,50)
t.setheading(-7)
t.forward(260)
t.setheading(5)
t.circle(-250,15)
t.left(10)
t.circle(-15,100)
t.right(13.8)
t.circle(-80,20)
t.right(15)
t.circle(-200,38)


t.penup()
t.goto(216,-1)
t.pendown()
t.setheading(-47)
t.circle(-15,50)
t.right(13.8)
t.circle(-80,20)
t.right(15)
t.circle(-200,38)
t.setheading(170)
t.forward(250)
t.right(18)
t.circle(-200,8)
t.right(10)
t.circle(-35,50)

t.end_fill()

#轮子1
t.colormode(255)
t.fillcolor(180,180,180)
t.begin_fill()
t.penup()
t.goto(89,-103)
t.pendown()
t.circle(25)
t.end_fill()

t.colormode(255)
t.fillcolor(150,150,150)
t.begin_fill()
t.penup()
t.goto(85,-110)
t.pendown()
t.circle(25)
t.end_fill()

t.fillcolor(100,100,100)
t.begin_fill()
t.penup()
t.goto(70,-109)
t.pendown()
t.circle(10)
t.end_fill()


#轮子杆

t.fillcolor(100,100,100)
t.begin_fill()

t.penup()
t.goto(88.5,-91.5)
t.setheading(45)
t.pendown()
t.forward(28)
t.setheading(-177)
t.fd(25)
t.setheading(-135)
t.fd(9)
t.setheading(-29)
t.circle(-25,45)
t.end_fill()

t.penup()
t.goto(79,-78)
t.setheading(45)
t.pendown()
t.forward(9)


#轮子2
t.colormode(255)
t.fillcolor(180,180,180)
t.begin_fill()
t.penup()
t.goto(-105,-89.5)
t.pendown()
t.circle(25)
t.end_fill()

t.colormode(255)
t.fillcolor(150,150,150)
t.begin_fill()
t.penup()
t.goto(-110,-96)
t.pendown()
t.circle(25)
t.end_fill()

t.fillcolor(100,100,100)
t.begin_fill()
t.penup()
t.goto(-120,-85)
t.pendown()
t.circle(10)
t.end_fill()

#轮子杆

t.fillcolor(100,100,100)
t.begin_fill()

t.penup()
t.goto(-100,-65)
t.setheading(45)
t.pendown()
t.forward(28)
t.setheading(170)
t.fd(23)
t.setheading(-135)
t.forward(13)
t.setheading(-20)
t.circle(-25,45)

t.end_fill()

#轮子3
t.fillcolor(150,150,150)
t.begin_fill()
t.penup()
t.goto(99,-84)
t.pendown()
t.setheading(-30)
t.circle(25,106)
t.setheading(-175)
t.fd(22)
t.setheading(-135)
t.fd(20)
t.end_fill()

t.fillcolor(200,200,200)
t.begin_fill()
t.penup()
t.goto(123,-85)
t.pendown()
t.setheading(10)
t.circle(25,65)
t.setheading(-160)
t.fd(10)
t.setheading(-110)
t.circle(-25,60)
t.end_fill()

t.fillcolor(150,150,150)
t.begin_fill()
t.penup()
t.goto(-82.1,-49.1)
t.pendown()
t.setheading(-35)
t.circle(25,70)
t.setheading(170)
t.fd(27)
t.setheading(-135)
t.fd(7.1)
t.end_fill()

#t.forward(40)
#t.right(10)
#t.circle(-70,30)
t.hideturtle()

          

效果图:

猜你喜欢

转载自blog.csdn.net/Echo_165/article/details/123978502
今日推荐