【整活】使用海龟画图画一个绿码

【整活】使用海龟画图画一个绿码,第1张

【整活】使用海龟画图画一个·绿码·

文章目录
  • 前言
  • 展示
  • 一、使用了什么工具
  • 二、使用步骤
    • 1.引入库
    • 2.完整代码
  • 总结


前言

例如:全球疫情事态严重,希望疫情早日退散,今天用python中的画图库画一个绿码。


展示

视频展示:https://www.bilibili.com/video/BV1aY4y1Y73e?spm_id_from=333.999.0.0(b站)
图片展示:

一、使用了什么工具

1.python
2.turtle

二、使用步骤 1.引入库

代码如下(示例):

import turtle as h
2.完整代码

代码如下(示例):

import turtle as h
from unicodedata import name
h.setup(width=400,height=675)
h.title("行程码")
h.screensize(300,500,"#2ba568")
h.speed(1)
# 框
h.begin_fill()
h.color("#ffffff","#ffffff")
h.penup()
h.goto(-150,-150)
h.pendown()
h.goto(-150,200)
h.goto(150,200)
h.goto(150,-150)
h.goto(-150,-150)
h.end_fill()
# 绿色圆圈
h.penup()
h.goto(0,-60)
h.begin_fill()
h.color("#2ba568","#2ba568")

h.circle(70)
h.end_fill()
h.penup()
h.goto(0,-50)
h.pendown()
h.begin_fill()
h.color("#ffffff","#ffffff")
h.circle(60)
h.end_fill()
# 绿色圆圈
# 箭头下部分

h.penup()
h.color("#2ba568","#2ba568")
h.begin_fill()
h.goto(5,-40)
h.pendown()
h.goto(5,40)
h.goto(-5,40)
h.goto(-5,-40)
h.goto(5,-40)
h.end_fill()
# 箭头上部分
h.penup()
h.color("#2ba568","#2ba568")
h.begin_fill()
h.goto(5,40)
h.pendown()
h.goto(35,10)
h.goto(35,20)
h.goto(0,60)
h.goto(-35,20)
h.goto(-35,10)
h.goto(-5,40)
h.goto(5,40)
h.end_fill()
# 文字部分
h.penup()
h.goto(-130,250)
h.color("#ffffff","#ffffff")
h.write("通信大数据行程卡",font=("黑体",25,"bold"))
h.penup()
h.goto(-80,215)
h.color("#ffffff","#ffffff")
h.write("疫情防控,人人有责",font=("黑体",13))
h.penup()
h.goto(-90,160)
h.color("#000000","#ffffff")
h.write("全中国人民的动态行程卡",font=("黑体",13))
h.penup()
h.goto(-50,120)
h.color("#8e8e8e","#8e8e8e")
h.write("更新于:每一天",font=("黑体",12))
h.penup()
h.goto(-140,-100)
h.pendown()
h.color("#8e8e8e","#8e8e8e")
h.goto(140,-100)
h.penup()
h.goto(-140,-130)
h.color("#8e8e8e","#8e8e8e")
h.write("您于前14天内到达或途径:",font=("黑体",10))
h.penup()
h.goto(-140,-180)
h.color("#ffffff","#ffffff")
h.write("结果包涵您在前14天内到访的国家(地区)与停留4小时以上的",font=("Arial",8))
h.penup()
h.goto(-80,-200)
h.color("#ffffff","#ffffff")
h.write("国内城市色卡,仅对造访地做提醒",font=("Arial",8))
h.penup()
h.goto(-140,-240)
h.pendown()
h.goto(-60,-240)
h.penup()
h.goto(-40,-250)
h.write("本服务联合提供",font=("Arial",10))
h.penup()
h.goto(70,-240)
h.pendown()
h.goto(140,-240)
h.penup()
h.goto(-60,-290)

h.color("#ffffff","#ffffff")
h.write("客服热线:8208 / 2088 /2 0",font=("Arial",8))
h.done()

总结

使用了python中的turtle绘制图形
希望疫情结束!!!!!!!!!!!!!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/873334.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存