Python教程44:海龟画图turtle画卡塔尔世界杯吉祥物

news2024/9/27 17:25:50

---------------turtle源码集合---------------

Python教程42:海龟画图turtle画海绵宝宝

Python教程41:海龟画图turtle画蜡笔小新

Python教程40:使用turtle画一只杰瑞

Python教程39:使用turtle画美国队长盾牌

Python教程38:使用turtle画动态粒子爱心+文字爱心

Python教程37:使用turtle画一个戴帽子的皮卡丘

Python教程36:海龟画图turtle写春联

Python源码35:海龟画图turtle画中国结

Python源码31:海龟画图turtle画七道彩虹

Python源码30:海龟画图turtle画紫色的小熊

Python源码29:海龟画图turtle画太极图

Python源码28:海龟画图turtle画熊猫

Python源码27:海龟画图turtle画动态圆舞曲

Python源码26:海龟画图turtle画向日葵

Python源码25:海龟画图turtle画小猪佩奇

Python源码24:使用海龟画图turtle画滑板

Python源码23:使用海龟画图turtle画小狗狗

Python源码22:使用海龟画图turtle画今天日期

Python源码21:使用海龟画图turtle画太阳,云朵,房子,绿树

Python源码20:使用海龟画图turtle画一个会动的星空

Python源码19:海龟画图turtle画螺旋的彩色的逐渐放大的文字

Python源码18:使用海龟画图turtle画捂脸表情

Python源码17:使用海龟画图turtle画五星红旗

Python源码16:使用海龟画图turtle画会动的时钟

Python源码15:使用海龟画图turtle画小黄人

Python源码14:使用海龟画图turtle画我的城堡

Python源码分享13:使用海龟画图turtle画一个会眨眼的皮卡丘

Python源码分享12:使用turtle画彩色六边形

Python源码分享11:使用海龟画图turtle画航天火箭

Python源码分享10:使用海龟画图turtle画哆啦A梦

Python源代码分享:02海龟画图五角星

Python源代码分享:03画一个奥运五环图

Python源代码分享:05使用turtle模块绘制一个彩色螺旋图案

Python源代码分享:07画满天繁星

Python源码分享08:使用turtle画一朵玫瑰花

Python源码分享10:使用海龟画图turtle画哆啦A梦

Python源码分享11:使用海龟画图turtle画航天火箭

Python源码分享12:使用turtle画彩色六边形
在这里插入图片描述

# @Author : 小红牛
# 微信公众号:WdPython
import turtle as t
# 设置背景颜色,窗口位置以及大小

t.colormode(255)  # 颜色模式
t.speed(0)
t.screensize(800, 700, "black")  # 画布大小背景颜色
t.setup(width=800, height=700, startx=None, starty=None)  # 绘图窗口的大小和起始坐标

t.title('2022卡塔尔世界杯吉元素!')  # 设置绘图窗口的标题
t.resizemode('noresize')  # 大小调整模式:auto,user,noresize
t.tracer(1)
t.hideturtle()


def mlingpen(x, y):
    t.penup()
    t.goto(x, y)
    t.pendown()


def mlingfacecheek(x, y, fx):
    mlingpen(x, y)
    t.seth(fx)
    t.pencolor("#fcd1ae")
    t.fillcolor('#fcd1ae')
    t.begin_fill()
    n = 1.8
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            n -= 0.05
            t.left(3)
            t.fd(n)
        else:
            n += 0.05
            t.left(3)
            t.fd(n)
    t.end_fill()


def mlingfacecheek_h(x, y, fx):
    mlingpen(x, y)
    t.seth(fx)
    t.pencolor("#fcc6ae")
    t.fillcolor('#fcc6ae')
    t.begin_fill()
    n = 1.6
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            n -= 0.06
            t.left(3)
            t.fd(n)
        else:
            n += 0.06
            t.left(3)
            t.fd(n)
    t.end_fill()


def mlingellipse(x, y, jiajiao, l, size, color1, color2):
    mlingpen(x, y)
    t.seth(jiajiao + 270)
    t.pensize(size)
    t.pencolor(color1)
    t.fillcolor(color2)
    t.pendown()
    t.begin_fill()
    a = 0.3
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a += l
            t.lt(3)
            t.fd(a)
        else:
            a -= l
            t.lt(3)
            t.fd(a)
    t.penup()
    t.end_fill()


def mlingrotate_left(chishu, angle, length):
    for i in range(chishu):
        t.left(angle)
        t.forward(length)


def mlingrotate_right(chishu, angle, length):
    for i in range(chishu):
        t.right(angle)
        t.forward(length)


def llaeebeye():
    # AdversityAwake
    t.seth(22)
    mlingpen(80, 62)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(40, 62)
    t.circle(21, 160)
    t.circle(40, 53)
    t.goto(80, 62)
    t.end_fill()
    t.seth(20)
    mlingpen(80, 62)
    t.pensize(2)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(35, 62)
    t.circle(20, 164)
    t.circle(40, 53)
    t.goto(80, 62)
    t.end_fill()
    t.seth(30)
    mlingpen(76, 65)
    t.pensize(3)
    t.pencolor("#452b14")
    t.fillcolor('#e58f59')
    t.begin_fill()
    t.circle(31, 90)
    t.lt(12)
    t.circle(12, 70)
    t.lt(27)
    t.circle(40, 68)
    t.goto(76, 65)
    t.end_fill()
    t.seth(0)
    mlingpen(66, 72)
    t.pensize(1)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(20, 120)
    t.circle(10, 120)
    t.lt(6)
    t.circle(40, 40)
    t.goto(66, 72)
    t.end_fill()
    t.seth(0)
    mlingpen(68, 75)
    t.pencolor("#373331")
    t.fillcolor('#3f3a38')
    t.begin_fill()
    t.circle(5, 360)
    t.end_fill()
    t.seth(0)
    mlingpen(73, 102)
    t.pensize(1)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(6, 360)
    t.end_fill()
    # AdversityAwake
    t.seth(40)
    mlingpen(10, 70)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(30, 170)
    t.circle(23, 120)
    t.goto(10, 70)
    t.end_fill()
    t.seth(44)
    mlingpen(10, 70)
    t.pensize(2)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(29, 170)
    t.circle(23, 100)
    t.goto(10, 70)
    t.end_fill()
    t.seth(30)
    mlingpen(0, 75)
    t.pensize(3)
    t.pencolor("#452b14")
    t.fillcolor('#e58f59')
    t.begin_fill()
    t.circle(23, 280)
    t.goto(0, 75)
    t.end_fill()
    t.seth(30)
    mlingpen(-3, 82)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(15, 360)
    t.goto(-3, 82)
    t.end_fill()
    t.seth(0)
    mlingpen(-11, 82)
    t.pencolor("#373331")
    t.fillcolor('#3f3a38')
    t.begin_fill()
    t.circle(5, 360)
    t.end_fill()
    t.seth(0)
    mlingpen(-6, 102)
    t.pensize(1)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(6, 360)
    t.end_fill()


def llaeebmeim():
    t.seth(100)
    mlingpen(-30, 125)
    t.pensize(2)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.goto(25, 133)
    t.circle(10, 100)
    t.rt(30)
    t.circle(50, 60)
    t.goto(-30, 125)
    t.end_fill()
    # AdversityAwake
    t.seth(120)
    mlingpen(60, 130)
    t.pensize(2)
    t.pencolor("#000000")
    t.fillcolor('#000000')
    t.begin_fill()
    t.goto(106, 130)
    t.circle(30, 40)
    t.circle(25, 80)
    t.goto(60, 130)
    t.end_fill()


def llaeebmouse():
    # AdversityAwake
    t.seth(-30)
    mlingpen(0, 55)
    t.pensize(3)
    t.pencolor("#000000")
    # t.begin_fill()
    t.circle(130, 16)
    t.circle(48, 40)
    # t.end_fill()


def llaeebbozi():
    # AdversityAwake
    t.seth(120)
    mlingpen(145, 40)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#805d57')
    t.begin_fill()
    t.circle(12, 120)
    t.rt(30)
    t.circle(55, 17)
    t.rt(10)
    t.circle(-110, 70)
    t.circle(100, 50)
    t.circle(50, 45)
    t.goto(-140, -210)
    t.goto(110, -210)
    t.lt(120)
    t.circle(100, 60)
    t.goto(145, 40)
    t.end_fill()


def llaeebyifu():
    t.seth(160)
    mlingpen(-70, 140)
    t.pencolor("#624655")
    t.pensize(6)
    t.circle(170, 20)
    t.circle(30, 95)
    t.dot(15, "#624655")
    t.seth(-100)
    mlingpen(-70, 140)
    t.circle(-30, 130)
    t.dot(15, "#624655")
    t.seth(-180)
    mlingpen(-70, 140)
    t.circle(30, 50)
    t.circle(-190, 20)
    t.circle(190, 20)
    t.circle(-30, 50)
    t.dot(15, "#624655")
    t.seth(190)
    mlingpen(-70, 140)
    t.circle(-250, 20)
    t.circle(250, 10)
    t.circle(-30, 50)
    t.dot(15, "#624655")
    # AdversityAwake
    t.seth(0)
    mlingpen(-140, -210)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.goto(110, -210)
    t.circle(100, 60)
    t.lt(20)
    t.circle(50, 20)
    t.circle(-50, 30)
    t.circle(80, 60)
    t.goto(100, 140)
    t.rt(20)
    t.circle(80, 60)
    t.circle(100, 60)
    t.circle(190, 10)
    t.rt(15)
    t.circle(290, 55)
    t.goto(-140, -210)
    t.end_fill()


def llaeebhand():
    t.seth(0)
    mlingpen(195, -165)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.lt(75)
    t.circle(50, 20)
    t.circle(-50, 30)
    t.circle(80, 60)
    t.goto(150, 40)
    t.lt(130)
    t.circle(-100, 70)
    t.goto(20, -40)
    t.lt(105)
    t.circle(200, 60)
    t.goto(195, -165)
    t.end_fill()
    t.seth(0)
    mlingpen(190, -160)
    t.pensize(2)
    t.pencolor("#eee7f1")
    t.fillcolor('#eee7f1')
    t.begin_fill()
    t.lt(75)
    t.circle(50, 20)
    t.circle(-50, 30)
    t.circle(80, 60)
    t.goto(147, 25)
    t.lt(130)
    t.circle(-100, 20)
    t.end_fill()
    t.seth(0)
    mlingpen(185, -160)
    t.pensize(2)
    t.pencolor("#faf4fc")
    t.fillcolor('#faf4fc')
    t.begin_fill()
    t.lt(75)
    t.circle(50, 20)
    t.circle(-50, 30)
    t.circle(75, 55)
    t.goto(145, 21)
    t.lt(130)
    t.circle(-95, 30)
    t.end_fill()
    t.seth(0)
    mlingpen(185, -160)
    t.pensize(2)
    t.pencolor("#fdfafe")
    t.fillcolor('#fdfafe')
    t.begin_fill()
    t.lt(75)
    t.circle(45, 20)
    t.circle(-45, 30)
    t.circle(65, 55)
    t.goto(143, 13)
    t.lt(130)
    t.circle(-95, 30)
    t.end_fill()
    # AdversityAwake
    t.seth(-80)
    mlingpen(-127.85, 12.90)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(46, 55)
    t.lt(60)
    t.circle(-30, 40)
    t.lt(10)
    t.circle(-150, 30)
    t.goto(20, -40)
    t.goto(110, -5)
    t.circle(-8, 80)
    t.lt(2)
    t.circle(-280, 55)
    t.goto(-140, -210)
    t.rt(89)
    t.circle(-300, 48)
    t.goto(-127.85, 12.90)
    t.end_fill()
    t.seth(-120)
    mlingpen(-101.00, -20.80)
    t.circle(90, 32)
    t.lt(120)
    t.circle(-80, 50)
    t.circle(66, 60)
    mlingpen(40, -80)
    mlingellipse(40, -80, 46, 0.06, 3, "#911a2b", "#dd4159")
    mlingellipse(52, -66, 45, 0.01, 3, "#911a2b", "#ffffff")
    mlingpen(45, -74)
    t.dot(9, "#ffffff")
    mlingpen(46, -60)
    t.dot(9, "#ffffff")
    mlingpen(56, -48)
    t.dot(9, "#ffffff")
    mlingpen(72, -46)
    t.dot(9, "#ffffff")
    mlingpen(59, -75)
    t.dot(9, "#ffffff")
    mlingpen(73, -64)
    t.dot(9, "#ffffff")
    t.pensize(3)
    t.pencolor("#911a2b")
    t.fillcolor('#dd4159')
    t.begin_fill()
    mlingpen(10, -100)
    t.goto(20, -100)
    t.lt(90)
    t.fd(20)
    t.lt(135)
    t.fd(10)
    t.goto(10, -100)
    t.end_fill()
    t.pensize(10)
    mlingpen(100, -80)
    t.goto(110, -85)
    t.pensize(3)
    mlingpen(-50, -35)
    t.goto(-20, -45)
    t.pencolor("#000000")


t.pencolor("#fdfafe")
mlingpen(290, 75)
t.write("吉\n祥\n物\n", align="center", font=("楷体", 18, "normal"))
t.up()


def llaeebtoumao():
    t.seth(0)
    mlingpen(105, 135)
    t.pensize(3)
    t.pencolor("#000000")
    t.fillcolor('#624655')
    t.begin_fill()
    t.circle(10, 155)
    t.rt(90)
    t.circle(8, 90)
    t.lt(8)
    t.circle(270, 38)
    t.lt(5)
    t.circle(8, 100)
    t.rt(90)
    t.circle(10, 100)
    t.lt(110)
    t.circle(-20, 50)
    t.circle(-270, 18)
    t.lt(5)
    t.circle(-250, 18)
    t.goto(105, 135)
    t.end_fill()


if __name__ == '__main__':
    llaeebyifu()
    llaeebbozi()
    llaeebhand()
    llaeebtoumao()
    llaeebmouse()
    llaeebmeim()
    llaeebeye()
    t.done()

完毕!!感谢您的收看

----------★★历史博文集合★★----------
我的零基础Python教程,Python入门篇 进阶篇 视频教程 Py安装py项目 Python模块 Python爬虫 Json Xpath 正则表达式 Selenium Etree CssGui程序开发 Tkinter Pyqt5 列表元组字典数据可视化 matplotlib 词云图 Pyecharts 海龟画图 Pandas Bug处理 电脑小知识office自动化办公 编程工具
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1387262.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

国内镜像源配置方法(包括临时和永久方法)

国内镜像源&#xff1a; 阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/豆瓣 http://pypi.douban.com/simplePython官方 https://pypi.python.org/simple/v2ex http://pypi.v2ex.com/simple/中国科学院 http://pypi.mi…

Web server failed to start. Port 8080 was already in use. 端口被占用

Web server failed to start. Port 8080 was already in use. 端口被占用。 1、cmd回车打开命令窗口 查看端口号是否被占用 netstat -ano|findstr “8080” 2、查看进程号对应的进程名称 tasklist|findstr “12760” 3、直接杀死进程 taskkill /F /pid 12760或 taskkill /F …

腾讯云服务器租用价格表_2024新版报价

腾讯云服务器租用价格表&#xff1a;轻量应用服务器2核2G3M价格62元一年、2核2G4M价格118元一年&#xff0c;540元三年、2核4G5M带宽218元一年&#xff0c;2核4G5M带宽756元三年、轻量4核8G12M服务器446元一年、646元15个月&#xff0c;云服务器CVM S5实例2核2G配置280.8元一年…

Linux-ARM裸机(十一)-UART串口通信

无论单片机开发还是嵌入式 Linux 开发&#xff0c;串口都是最常用到的外设。可通过串口将开发板与电脑相连&#xff0c;然后在电脑上通过串口调试助手来调试程序。还有很多的模块&#xff0c;比如蓝牙、GPS、 GPRS 等都使用的串口来与主控进行通信的&#xff0c;在嵌入式 Linux…

java处理16进制字符串的一些方法和基础知识

前言&#xff1a;本篇文章是对于基础数据的处理的一些简单经验总结里边包含了一些基础的数据储存和数据转化的一些知识&#xff0c;同样也包含有部分快捷的数据处理方法。主要用于个人知识的一个记录和方便进行对应的数据转换和处理。 1、bit,字节和字的关系 1.1 bit和字节的…

leetcode 24两两交换链表中的节点

题目 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff08;即&#xff0c;只能进行节点交换&#xff09;。 思想 对于操作链表节点的时候&#xff0c;首先需要就是创建一个虚拟的…

表单验证 ---- 在Vue2中使用ElementUI进行表单验证

目录 前言 给表单绑定对应属性 在data中定义数据对象和表单的定义规则 与数据对象双向绑定 对整个表单进行验证 前言 在做项目时&#xff0c;对于表单进行验证是我们必不可少的 例如 搭建一个基本的登录界面 <div class"form"><h1>登录</h1>&…

OPT(erlang)打造一套缓存系统(一)

缓存的设计 这个简易缓存存储的是键/值对&#xff0c;其中键与键之间不得重复&#xff0c;并且每个键只能映射到一个值。这个设计背后的核心思想是为写人缓存的每一个值都分配一个独立的存储进程再将对应的键映射至该进程。你可能会对这种为每个值分配一个进程的设计感到惊讶&…

2024年学鸿蒙开发就业前景怎么样?

随着科技的不断进步&#xff0c;鸿蒙系统作为华为自主研发的操作系统&#xff0c;逐渐引起了人们的关注。 2024年&#xff0c;鸿蒙开发就业前景如何&#xff1f; 对于那些对鸿蒙开发感兴趣并希望在这一领域寻找职业发展的人来说&#xff0c;这是一个非常重要的问题。 首先&a…

【电子取证篇】蘇小沐的电子取证工具合集在线文档

【电子取证篇】蘇小沐的电子取证工具合集在线文档 弄成了在线表格&#xff0c;记得及时保存&#xff1b;工具永远只是辅助&#xff0c;但不要过多依赖自动化&#xff0c;有难度说明可以提升&#xff0c;既要不断学习也要不停思考&#xff0c;知行合一—【蘇小沐】 【腾讯文档…

springboot项目启动时横幅修改

正常情况下&#xff0c;springboot启动时的横幅&#xff08;banner&#xff09;长这样 自定义banner 在resource下创建banner.txt&#xff0c;写入想要修改的内容即可 程序无bugSpring Boot Version: ${spring-boot.version}// _ooOoo_ …

力扣-刷MySQL(详细解析)

&#x1f389;欢迎您来到我的MySQL基础复习专栏 ☆* o(≧▽≦)o *☆哈喽~我是小小恶斯法克&#x1f379; ✨博客主页&#xff1a;小小恶斯法克的博客 &#x1f388;该系列文章专栏&#xff1a;重拾MySQL &#x1f379;文章作者技术和水平很有限&#xff0c;如果文中出现错误&am…

16 命令行模式

命令行模式 将行为的执行与与行为的调用通过命令分离&#xff0c;行为的的调用者不需要知道具体是哪个类执行的&#xff0c;他们之间通过命令连接。 demo的目录结构 命令的执行者&#xff08;接口&#xff09; package behavioralpattern.commandpattern.actuator;import ja…

2024年腾讯云服务器多少钱1年?超便宜62元一年

腾讯云服务器租用价格表&#xff1a;轻量应用服务器2核2G3M价格62元一年、2核2G4M价格118元一年&#xff0c;540元三年、2核4G5M带宽218元一年&#xff0c;2核4G5M带宽756元三年、轻量4核8G12M服务器446元一年、646元15个月&#xff0c;云服务器CVM S5实例2核2G配置280.8元一年…

Github项目推荐-clone-voice

项目地址 GitHub - jianchang512/clone-voice 项目简述 一个声音ai工具。基于python编写。作用是音色复用。下面是官方说明&#xff1a;“这是一个声音克隆工具&#xff0c;可使用任何人类音色&#xff0c;将一段文字合成为使用该音色说话的声音&#xff0c;或者将一个声音使…

新火种AI|GPT-5前瞻!GPT-5将具备哪些新能力?

作者&#xff1a;小岩 编辑&#xff1a;彩云 Sam Altman在整个AI领域&#xff0c;乃至整个科技领域都被看作是极具影响力的存在&#xff0c;而2023年OpenAI无限反转的宫斗事件更是让Sam Altman刷足了存在感&#xff0c;他甚至被《时代》杂志评为“2023年度CEO”。 也正因此&…

Modbus协议学习第二篇之Modbus poll slave仿真软件初体验

软件准备 学习Modbus离不开硬件&#xff0c;好在我们可以通过仿真软件来模拟硬件&#xff0c;本篇博客就来简单介绍一下Modbus仿真软件的最基础使用方法&#xff0c;需要用到的3款仿真软件如下&#xff1a; Modbus Poll 64位 / Modbus Poll 32位&#xff08;根据自己机器位数选…

【Python学习】Python学习14-函数

目录 【Python学习】Python学习14-函数 前言自定义函数创建语法自定义函数与调用参数传递参考 文章所属专区 Python学习 前言 本章节主要说明Python的函数。函数是组织好的&#xff0c;可重复使用的&#xff0c;用来实现单一&#xff0c;或相关联功能的代码段。 函数能提高应…

自定义vector的实现

实现前需要思考的一个问题 为什么需要将空间的申请与对象的构建分开 查看vector的模板参数时可以看到其有第三个参数是空间适配器allocator&#xff0c;查找其对外提供的成员函数不难发现它的实现逻辑是将空间的申请与对象的构建分开的&#xff0c;为什么呢&#xff1f;不弄清…

云畅科技技术中心被认定为湖南省省级企业技术中心

近日&#xff0c;湖南省工业和信息化厅公布《2023年第二批湖南省省级企业技术中心(第29批)》&#xff0c;云畅科技技术中心作为研发设计型代表入选。 省级企业技术中心是强化企业技术创新主体地位&#xff0c;增强企业自主创新能力&#xff0c;推动工业企业高质量发展的一个重要…