首页 > 社交 > 科普中国

python程序员的浪漫

常驻编辑 科普中国 2022-08-01 步长   方正   眼白   冰糖   画笔   眼珠   眼圈   程序员   昵称   女朋友   代码   浪漫

这不,女朋友生日快到了!BSx拜客生活常识网

什么!!!你没准备礼物?BSx拜客生活常识网

下面这段千行生日祝福代码值得你去试一试!BSx拜客生活常识网

二话不说,先上代码!BSx拜客生活常识网

import turtle as timport timeimport math as mimport random as r # 设置画布t.setup(1.0, 1.0)t.bgcolor('white')t.title('生日快乐!')  # 设置标题# 设置速度t.speed(2)  # 速度t.delay(2)  # 延迟# t.tracer(False)  # 一次性出图t.shape('turtle')  # 设置画笔形状# 称呼t.penup()t.goto(-500, 250)msg = '昵称'  # 此处可以修改昵称for i in msg:    t.color('green')    t.write(i, True, align='left', font=('方正舒体', 70, 'normal'))    time.sleep(0.3)# 冰墩墩# 左耳t.color('black')t.penup()t.goto(-150, 200)t.setheading(160)t.begin_fill()t.pendown()t.circle(-30, 230)t.setheading(180)t.circle(37, 90)t.end_fill()# 右耳t.penup()t.goto(60, 200)t.setheading(20)t.begin_fill()t.pendown()t.circle(30, 230)t.setheading(0)t.circle(-37, 90)t.end_fill()# 头t.pensize(5)t.penup()t.goto(-113, 237)t.setheading(30)t.pendown()t.circle(-134, 60)t.penup()t.goto(-150, 200)t.setheading(-120)t.pendown()t.circle(200, 80)t.penup()t.goto(60, 200)t.setheading(-60)t.pendown()t.circle(-200, 80)t.penup()t.setheading(210)t.pendown()t.circle(-120, 60)# 左眼t.speed(10)t.delay(1)# 眼圈t.penup()t.goto(-140, 100)t.setheading(-45)t.begin_fill()t.pendown()a = 0.2for i in range(120):    if 0 <= i < 30 or 60 <= i < 90:        a = a + 0.1        t.lt(3)  # 向左转3度        t.fd(a)  # 向前走a的步长    else:        a = a - 0.1        t.lt(3)        t.fd(a)t.end_fill()# 眼白t.fillcolor("white")t.penup()t.goto(-103, 125)t.setheading(0)t.begin_fill()t.pendown()t.circle(14, 360)t.end_fill()# 眼珠t.penup()t.goto(-102, 133)t.setheading(0)t.begin_fill()t.pendown()t.circle(6, 360)t.end_fill()# 右眼# 眼圈t.penup()t.goto(50, 100)t.setheading(45)t.fillcolor("black")t.pencolor("black")t.begin_fill()t.pendown()a = 0.2for i in range(120):    if 0 <= i < 30 or 60 <= i < 90:        a = a + 0.1        t.lt(3)  # 向左转3度        t.fd(a)  # 向前走a的步长    else:        a = a - 0.1        t.lt(3)        t.fd(a)t.end_fill()# 眼白t.fillcolor("white")t.penup()t.goto(13, 125)t.setheading(0)t.begin_fill()t.pendown()t.circle(14, 360)t.end_fill()# 眼珠t.penup()t.goto(12, 133)t.setheading(0)t.begin_fill()t.pendown()t.circle(6, 360)t.end_fill()# 鼻子t.speed(2)t.delay(2)t.pencolor("black")t.fillcolor("black")t.penup()t.goto(-55, 133)t.begin_fill()t.pendown()t.fd(20)t.seth(-120)t.fd(20)t.seth(120)t.fd(20)t.end_fill()# 嘴t.penup()t.goto(-70, 110)t.setheading(-30)t.fillcolor("red")t.begin_fill()t.pendown()t.circle(50, 60)t.setheading(-120)t.circle(-100, 15)t.circle(-15, 90)t.circle(-100, 15)t.end_fill()# 四肢# 左臂t.penup()t.goto(-175, 100)t.fillcolor("black")t.begin_fill()t.setheading(-120)t.pendown()t.fd(100)t.setheading(-110)t.circle(20, 180)t.fd(30)t.circle(-5, 160)t.end_fill()# 右臂t.penup()t.goto(85, 100)t.setheading(60)t.begin_fill()t.pendown()t.fd(100)t.setheading(70)t.circle(20, 180)t.fd(30)t.circle(-5, 160)t.end_fill()# 小红心t.penup()t.pencolor("red")t.fillcolor('red')t.goto(105, 200)t.begin_fill()t.pendown()t.circle(-5, 180)t.setheading(90)t.circle(-5, 180)t.setheading(-120)t.fd(17)t.penup()t.goto(105, 200)t.pendown()t.setheading(-60)t.fd(17)t.end_fill()t.pencolor("black")t.fillcolor("black")# 左腿t.penup()t.goto(-120, -45)t.begin_fill()t.pendown()t.setheading(-90)t.circle(-140, 20)t.circle(5, 109)t.fd(30)t.circle(10, 120)t.setheading(90)t.circle(-140, 10)t.end_fill()# 右腿t.penup()t.goto(30, -45)t.begin_fill()t.pendown()t.setheading(-90)t.circle(140, 20)t.circle(-5, 109)t.fd(30)t.circle(-10, 120)t.setheading(90)t.circle(140, 10)t.end_fill()# 冰糖外壳t.pensize(3)t.penup()t.goto(-160, 195)t.setheading(160)t.pendown()t.circle(-40, 230)t.setheading(30)t.circle(-134, 58)t.setheading(60)t.circle(-40, 215)t.setheading(-60)t.fd(15)t.circle(2, 200)t.setheading(65)t.fd(30)t.circle(-25, 180)t.fd(100)t.circle(2, 25)t.circle(-200, 47)t.circle(2, 60)t.circle(140, 23)t.circle(-2, 90)t.setheading(180)t.fd(70)t.circle(-2, 90)t.fd(30)t.setheading(-160)t.circle(-100, 35)t.setheading(-90)t.fd(30)t.circle(-2, 90)t.fd(70)t.circle(-2, 90)t.setheading(60)t.circle(140, 30)t.circle(2, 45)t.circle(-200, 19)t.circle(2, 130)t.fd(30)t.circle(-25, 180)t.fd(100)t.setheading(90)t.circle(-200, 30)# 冰糖面罩t.speed(1)t.delay(0)t.pensize(3)t.penup()t.goto(65, 120)t.setheading(90)t.pendown()t.pencolor("red")a = 1for i in range(120):    if 0 <= i < 30 or 60 <= i < 90:  # 控制a的变化        a = a + 0.25        t.lt(3)  # 向左转3度        t.fd(a)  # 向前走a的步长    else:        a = a - 0.25        t.lt(3)        t.fd(a)t.pencolor("orange")t.penup()t.goto(66, 120)t.pendown()a = 1for i in range(120):    if 0     

相关阅读:

  • 步长制药发展战略 步长制药转型战略 步长制药企业精神
  • 晚间公告|9月26日这些公告有看头
  • 使用
  • 10.18北上资金,买入比例最大前100名的个股,占比排名一览
  • 你微信运动见过七万多步的么?
  • 中老年人采用什么运动方式锻炼身体比较好?
  • 上班族工作繁忙,如何利用好空闲时间锻炼身体?
  • 看得见的效果,博乐宝B16免安装净饮机,实测对比结果惊人
  • 杨洋龚俊结合体长啥样?又疯又欲要爆了!!
  • 方正宽带怎么样(方正宽带是网通还是电信)
    • 网站地图 |
    • 声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。文章内容仅供参考,不做权威认证,如若验证其真实性,请咨询相关权威专业人士。