一直想画点儿东西,因为觉得turtle好像小学微机课接触过,那个时候可能是编程最早的启蒙,觉得很神奇。
效果图
其实原图是这样的……因为turtle没有现成的转着圈输出字母的方法,我也就偷懒了……
还没整理过的代码……(暂时记录一下,马上要出去吃东西啦啦啦啦啦)
from turtle import *
hideturtle()
speed(10)
color('white')
#goto(-150,150)
goto(0,-305)
# 外面那个圈圈
color('red')
pensize(5)
circle(radius=340)
# 里面那个圈圈
penup()
# color('white')
#goto(-150,150)
goto(0,-225)
pd()
color('red')
pensize(30)
circle(radius=270)
color('blue')
# 红色粗圈圈左边的白色条条
penup()
goto(0,10)
seth(180)
forward(210)
pendown()
pencolor('white')
pensize(65)
forward(75)
# 红色粗圈圈右边的白色条条
penup()
goto(0,10)
seth(0)
forward(210)
pendown()
pencolor('white')
pensize(65)
forward(75)
# 左边那个半圆
# pu()
# goto(-130,-30)
# pd()
# forward(30)
# circle(-100,30,50)
def half_left():
l = Turtle()
l.speed(10)
l.color('red')
l.pu()
l.goto(-130, -80)
l.pd()
# l.forward(30)
o = 60 # 开始的角度
l.pensize(5)
for i in range(60):
l.color('red')
l.seth(o)
l.forward(2)
o -= 0.7
l.pu()
l.seth(90)
l.forward(35)
l.pd()
u = 190
l.pensize(5)
for w in range(62):
l.color('red')
l.seth(u)
l.forward(3)
u += 0.9
l.seth(0)
l.forward(50)
l.pu()
l.forward(281) # 跑到右边去
l.pd()
o = 120 # 开始的角度
l.pensize(5)
for i in range(60):
l.color('red')
l.seth(o)
l.forward(2)
o += 0.7
l.pu()
l.seth(90)
l.forward(35)
l.pd()
u = -11
l.pensize(5)
for w in range(62):
l.color('red')
l.seth(u)
l.forward(3)
u -= 0.9
l.seth(180)
l.forward(50)
def color_squ():
l = Turtle()
l.color('red')
l.pensize(5)
# 红色块
l.pu()
l.goto(-10,250)
l.pd()
l.begin_fill()
l.fillcolor('red')
l.seth(0)
l.forward(38)
l.seth(270)
l.forward(50)
l.seth(180)
l.forward(38)
l.seth(90)
l.forward(50)
l.end_fill()
# 蓝色的块儿
l.pu()
l.goto(-10, 200)
l.pd()
l.color('blue')
l.begin_fill()
l.fillcolor('blue')
l.seth(0)
l.forward(38)
l.seth(270)
l.forward(53)
l.seth(180)
l.forward(38)
l.seth(90)
l.forward(53)
l.end_fill()
# 黄色的块儿
l.pu()
l.goto(-10, 147)
l.pd()
l.color('yellow')
l.begin_fill()
l.fillcolor('yellow')
l.seth(0)
l.forward(38)
l.seth(270)
l.forward(53)
l.seth(180)
l.forward(38)
l.seth(90)
l.forward(53)
l.end_fill()
# 绿色的块儿
l.pu()
l.goto(-10, 94)
l.pd()
l.color('green')
l.begin_fill()
l.fillcolor('green')
l.seth(0)
l.forward(38)
l.seth(270)
l.forward(53)
l.seth(180)
l.forward(38)
l.seth(90)
l.forward(53)
l.end_fill()
# 黑色的块儿
l.pu()
l.goto(-10, 41)
l.pd()
l.color('black')
l.begin_fill()
l.fillcolor('black')
l.seth(0)
l.forward(38)
l.seth(270)
l.forward(63)
l.seth(180)
l.forward(38)
l.seth(90)
l.forward(63)
l.end_fill()
def half_right():
l = Turtle()
l.color('red')
l.pu()
l.goto(154, -52)
l.pd()
# l.forward(30)
o = 125 # 开始的角度
l.pensize(5)
for i in range(60):
l.color('red')
l.seth(o)
l.forward(2)
o += 0.75
l.pu()
l.seth(90)
l.forward(33)
l.pd()
u = -5
l.pensize(5)
for w in range(55):
l.color('red')
l.seth(u)
l.forward(4.5)
u -= 1.2
l.seth(180)
l.forward(50)
color_squ()
# 左边的一个柱子
Turtle()
pu()
goto(-30,270)
pd()
pensize(4)
color('red')
seth(268)
forward(350)
seth(0)
forward(30)
seth(90)
forward(350)
seth(180)
forward(20)
# 右边的一个柱子
pu()
goto(0,0)
pu()
goto(30,270)
pd()
pensize(4)
color('red')
seth(270)
forward(350)
seth(0)
forward(30)
seth(92)
forward(350)
seth(180)
forward(20)
half_left()
pu()
goto(-30,-160)
pd()
write("1 9 5 1",font = ("Times", 30,"bold"))
done()