程序猿的520

上天收回你一个老婆,那么他一定还会还给你一个老婆。

你问我为什么?我只能说这种事情见得多了,我只想说懂得都懂,不懂的我也不多解释,毕竟自己知道就好,细细品吧。你们也别来问我怎么了,利益牵扯太大,说了对你我都没好处,当不知道就行了,其余的我只能说这里面水很深,牵扯到很多东西。详细情况你们自己是很难找的,网上大部分已经删除干净了,所以我只能说懂得都懂。

刚好今天520,那么作为程序员,整点活!用 turtle 表个白...

程序员的浪漫

先验货

上代码:

# 导入需要用到的模块
import turtle as tt
import time
# 画爱心的顶部
def LittleHeart():
    for i in range(200):
        tt.right(1)
        tt.forward(2)

love = '520'

# 窗口大小
tt.setup(width=800, height=500)
# 颜色
tt.color('red', 'pink')
# 笔粗细
tt.pensize(5)
# 速度
tt.speed(2)
# 提笔
tt.up()
# 隐藏笔
tt.hideturtle()
# 去到的坐标,窗口中心为0,0
tt.goto(0, -180)
tt.showturtle()
# 画上线
tt.down()
tt.speed(1)
tt.begin_fill()
tt.left(140)
tt.forward(224)
# 调用画爱心左边的顶部
LittleHeart()
# 调用画爱右边的顶部
tt.left(120)
LittleHeart()
# 画下线
tt.forward(224)
tt.end_fill()
tt.pensize(5)
tt.up()
tt.hidett()
# 在心中写字 一次
tt.goto(0, 0)
tt.showtt()
tt.color('#CD5C5C', 'pink')
# 在心中写字 font可以设置字体自己电脑有的都可以设 align开始写字的位置
tt.write(love, font=('kaiti', 40,), align="center")
tt.up()
tt.hidett()
time.sleep(2)
# 在心中写字 二次
tt.goto(0, 0)
tt.showtt()
tt.color('red', 'pink')
tt.write(love, font=('kaiti', 40,), align="center")
tt.up()
tt.hidett()
# 点击窗口关闭
window = tt.Screen()
window.exitonclick()

也许需要的前戏

如果你是windows,安装turtle可能会出现下面问题


(studyenv) E:\working\GBase\django_orm_48s\codespace\django_gbasedbt>pip install turtle
Collecting turtle
  Downloading turtle-0.0.2.tar.gz (11 kB)
    ERROR: Command errored out with exit status 1:
     command: 'E:\devlop\envs\anaconda\envs\studyenv\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\dafei\\AppData\\Local\\Temp\\pip-install-i3wdw9zc\\turtle_bb87823cd0bf40c7b00659bf322275b4\\setup.p
y'"'"'; __file__='"'"'C:\\Users\\dafei\\AppData\\Local\\Temp\\pip-install-i3wdw9zc\\turtle_bb87823cd0bf40c7b00659bf322275b4\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'
"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\dafei\AppData\Local\Temp\pip-pip-egg-info-haf9ipy6'
         cwd: C:\Users\dafei\AppData\Local\Temp\pip-install-i3wdw9zc\turtle_bb87823cd0bf40c7b00659bf322275b4\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dafei\AppData\Local\Temp\pip-install-i3wdw9zc\turtle_bb87823cd0bf40c7b00659bf322275b4\setup.py", line 40
        except ValueError, ve:
                         ^

    SyntaxError: invalid syntax
    ----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

把turtle的安装包下载下来, setup.py 的 40行修改成 except (*ValueError*, ve): ,再安装,走起。

关注 【 麒思妙想】解锁更多硬核。

历史文章导读

如果文章对您有那么一点点帮助,我将倍感荣幸

欢迎  关注、在看、点赞、转发 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

麒思妙想

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值