大家好,又见面了,我是你们的朋友全栈君。
# 导入模块
import turtle
# 人
turtle.penup()
turtle.goto(-100, 100)
turtle.pendown()
turtle.color(‘yellow’)
turtle.setheading(55)
turtle.circle(50, 280)
turtle.setheading(238)
turtle.forward(145)
turtle.setheading(-45)
turtle.circle(165, 85)
turtle.setheading(120)
turtle.forward(175)
turtle.penup()
turtle.goto(-120, 120)
turtle.pendown()
turtle.forward(25)
turtle.penup()
turtle.goto(-100, 140)
turtle.pendown()
turtle.forward(10)
turtle.penup()
turtle.goto(-110, 105)
turtle.pendown()
turtle.setheading(15)
turtle.circle(10, 60)
turtle.penup()
turtle.goto(-145, -105)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(50)
turtle.penup()
turtle.goto(-100, -105)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(50)
turtle.penup()
turtle.goto(-80, 65)
turtle.pendown()
turtle.setheading(30)
turtle.forward(65)
turtle.circle(10, 70)
turtle.forward(5)
turtle.circle(8, 60)
turtle.setheading(60)
turtle.circle(-5, 90)
turtle.setheading(-80)
turtle.forward(10)
turtle.setheading(30)
turtle.forward(18)
turtle.circle(-2, 180)
turtle.setheading(-150)
turtle.forward(19)
for i in range(1, 4, 1):
turtle.setheading(30)
turtle.forward(4)
turtle.circle(-2.2, 180)
turtle.forward(4.2)
turtle.setheading(170)
turtle.circle(-10, 36)
turtle.setheading(210)
turtle.forward(75)
# 心
turtle.penup()
turtle.goto(70, 90)
turtle.pendown()
turtle.color(‘red’)
turtle.begin_fill()
turtle.fillcolor()
turtle.setheading(135)
turtle.forward(80)
turtle.circle(-40, 180)
turtle.setheading(45)
turtle.circle(-40, 180)
turtle.forward(80)
turtle.end_fill()
# 心中填字
turtle.penup()
turtle.goto(48, 155)
turtle.pendown()
turtle.color(‘yellow’)
turtle.write(‘I Love You’)
# 移动右下方填字
turtle.penup()
turtle.goto(200, -300)
turtle.pendown()
turtle.color(‘blue’)
turtle.write(‘喜欢是棋逢对手,但爱是甘拜下风!’)
turtle.hideturtle()
turtle.done()
标签:turtle,表白,python,代码,penup,setheading,pendown,forward,circle
来源: https://www.cnblogs.com/Redskaber/p/14290168.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/143943.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...