美文网首页
程序员速学!女孩子拒绝不了这样的浪漫!

程序员速学!女孩子拒绝不了这样的浪漫!

作者: 飞鱼_9d08 | 来源:发表于2020-08-08 20:59 被阅读0次

    再过几个星期就是七夕了,想要拥有女朋友的程序员快看这里!

    今天就不更新干货学习了,因为有人向我反映:程序员不懂浪漫, 很难找到女朋友。

    谁说程序员是不懂浪漫的直男?程序员用心起来直男都扛不住! 程序员们快点看过来啊,不是程序员也不要紧,简单易懂,赶紧的,现学现卖,做给女朋友呀~

    python中用turtle画爱心表白 (熟练的人可以发挥创意,画点其他的)

    分享给热爱Android学习的大家一套免费的学习资源,包含整套的教学视频,体系化的PDF,还有很多学习笔记!有需要的自己来拿吧,白嫖机构的《Android架构视频+大厂面试专题PDF+学习笔记》

    工具:python3.7

    运行后的效果图:

    代码虽然有点长,但是语法简单易懂哈

    代码如下:

    import turtle
    str = input('请输入表白语:')
    turtle.speed(10)#画笔速度
    turtle.setup(1800,700,70,70)
    turtle.color('black', 'pink')# 画笔颜色
    turtle.pensize(3) # 画笔粗细
    turtle.hideturtle() # 隐藏画笔(先)
    turtle.up() # 提笔
    turtle.goto(-655, -255) # 移动画笔到指定起始坐标(窗口中心为0,0)
    turtle.down() #下笔
    turtle.showturtle() #显示画笔
    #画左边的小人
    turtle.goto(-600,-200)
    turtle.goto(-600,-120)
    turtle.circle(35)
    turtle.goto(-600,-200)
    turtle.forward(40)
    turtle.right(90)
    turtle.forward(60)
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-600, -160)
    turtle.down()
    turtle.showturtle()
    turtle.left(90)
    turtle.forward(55)
    turtle.right(45)
    turtle.forward(20)
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-600, -145)
    turtle.down()
    turtle.showturtle()
    turtle.goto(-545, -145)
    turtle.left(90)
    turtle.forward(20)
    #画第一个爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-500, -153)
    turtle.down()
    turtle.showturtle()
    turtle.right(90)
    turtle.forward(30)
    turtle.left(90)
    turtle.forward(30)
    turtle.left(45)
    turtle.circle(10.6,180)
    turtle.left(180)
    turtle.circle(10.6,180)
    turtle.end_fill()
    #下一个大爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-430, -143)
    turtle.down()
    turtle.showturtle()
    turtle.left(135)
    turtle.right(90)
    turtle.forward(50)
    turtle.left(90)
    turtle.forward(50)
    turtle.left(45)
    turtle.circle(17.67,180)
    turtle.left(180)
    turtle.circle(17.67,180)
    turtle.end_fill()
    #第三个爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-315, -133)
    turtle.down()
    turtle.showturtle()
    turtle.left(135)
    turtle.right(90)
    turtle.forward(70)
    turtle.left(90)
    turtle.forward(70)
    turtle.left(45)
    turtle.circle(24.74,180)
    turtle.left(180)
    turtle.circle(24.74,180)
    turtle.end_fill()
    #第四个爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-187, -133)
    turtle.down()
    turtle.showturtle()
    turtle.left(135)
    turtle.right(90)
    turtle.forward(70)
    turtle.left(90)
    turtle.forward(70)
    turtle.left(45)
    turtle.circle(24.74,180)
    turtle.left(180)
    turtle.circle(24.74,180)
    turtle.end_fill()
    #第5个爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-43.7, -143)
    turtle.down()
    turtle.showturtle()
    turtle.left(135)
    turtle.right(90)
    turtle.forward(50)
    turtle.left(90)
    turtle.forward(50)
    turtle.left(45)
    turtle.circle(17.67,180)
    turtle.left(180)
    turtle.circle(17.67,180)
    turtle.end_fill()
    #第6个爱心
    turtle.color('pink', 'pink')
    turtle.begin_fill()
    turtle.hideturtle()
    turtle.up()
    turtle.goto(53.88, -153)
    turtle.down()
    turtle.showturtle()
    turtle.right(90)
    turtle.right(225)
    turtle.forward(30)
    turtle.left(90)
    turtle.forward(30)
    turtle.left(45)
    turtle.circle(10.6,180)
    turtle.left(180)
    turtle.circle(10.6,180)
    turtle.end_fill()
    #画右边的小人
    turtle.hideturtle()
    turtle.up()
    turtle.goto(251.28, -255)
    turtle.down()
    turtle.showturtle()
    turtle.goto(196.28,-200)
    turtle.goto(196.28,-120)
    turtle.left(90)
    turtle.circle(35)
    turtle.goto(196.28,-200)
    turtle.left(180)
    turtle.forward(40)
    turtle.left(90)
    turtle.forward(60)
    turtle.hideturtle()
    turtle.up()
    turtle.goto(196.28,-160)
    turtle.down()
    turtle.showturtle()
    turtle.right(90)
    turtle.forward(55)
    turtle.left(45)
    turtle.forward(20)
    turtle.hideturtle()
    turtle.up()
    turtle.goto(196.28, -145)
    turtle.down()
    turtle.showturtle()
    turtle.right(45)
    turtle.forward(55)
    turtle.right(45)
    turtle.forward(20)
    #画气球线和气球
    #第一个气球
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-265, -133)
    turtle.down()
    turtle.showturtle()
    turtle.goto(-245, 0)
    turtle.right(135)
    turtle.circle(35)
    
    #第2个气球
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-265, -133)
    turtle.down()
    turtle.showturtle()
    turtle.goto(-305, 80)
    turtle.circle(40)
    
    #第3个气球
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-137, -133)
    turtle.down()
    turtle.showturtle()
    turtle.goto(-167, 0)
    turtle.circle(35)
    
    #第4一个气球
    turtle.hideturtle()
    turtle.up()
    turtle.goto(-137, -133)
    turtle.down()
    turtle.showturtle()
    turtle.goto(-117, 80)
    turtle.circle(40)
    
    #写字LOVE
    turtle.pencolor("GREEN")
    turtle.penup()
    turtle.goto(-245,10)
    turtle.write("O",move=False,align='center',font=("微软雅黑",30,'normal'))
    turtle.pencolor("PURPLE")
    turtle.penup()
    turtle.goto(-305,90)
    turtle.write("L",move=False,align='center',font=("微软雅黑",30,'normal'))
    turtle.pencolor("YELLOW")
    turtle.penup()
    turtle.goto(-167,10)
    turtle.write("V",move=False,align='center',font=("微软雅黑",30,'normal'))
    turtle.pencolor("ORANGE")
    turtle.penup()
    turtle.goto(-117, 90)
    turtle.write("E",move=False,align='center',font=("微软雅黑",30,'normal'))
    
    #写送给谁
    turtle.pencolor("PINK")
    turtle.penup()
    turtle.goto(300, 200)
    turtle.write(str,move=False,align='center',font=("方正舒体",30,'normal'))
    

    ————————————————

    原文链接:程序员速学!女孩子拒绝不了这样的浪漫! - 嘴强安卓程序员的文章 - 知乎
    https://zhuanlan.zhihu.com/p/166253400

    相关文章

      网友评论

          本文标题:程序员速学!女孩子拒绝不了这样的浪漫!

          本文链接:https://www.haomeiwen.com/subject/czahdktx.html