turtle绘制禁烟标志

@用turtle绘制禁烟标志
turtle绘制禁烟标志_第1张图片
代码块:
import turtle as t
t.setup(500, 500)

def rectangle(x, y, length, width, color):
t.pu()
t.seth(0)
t.goto(x, y)
t.pd()
t.begin_fill()
t.color(color)
t.fd(length)
t.right(-90)
t.fd(width)
t.right(-90)
t.fd(length)
t.right(-90)
t.fd(width)
t.end_fill()

def smoking_wave(x, y):
t.pencolor(‘grey’)
t.width(‘3’)
t.pu()
t.goto(x, y)
t.seth(-45)
t.pd()
for i in range(2):
t.circle(10, -80)
t.circle(-10, -80)

#烟身
rectangle(-85, 0, 150, 30, ‘black’)

#烟头
rectangle(70, 0, 5, 30, ‘red’)
rectangle(80, 0, 5, 30, ‘red’)

#细烟
smoking_wave(70, 34)
smoking_wave(80, 34)

#禁止标志
t.pu()
t.goto(-90, -60)
t.pencolor(‘red’)
t.width(‘20’)
t.pd()
t.circle(120, 360)
t.pu()
t.goto(-90, 100)
t.pencolor(‘red’)
t.width(‘20’)
t.pd()
t.fd(220)

t.done()

你可能感兴趣的:(turtle绘制禁烟标志)