本文使用python的turtle绘制3幅图代码示例:

1.绘制太阳花

import turtle as t
import time
t.color("red","yellow")
t.speed(10)
t.begin_fill()
for x in range(50):t.forward(200)t.left(170)
end_fill()
time.sleep(2)

2.绘制彩虹线

import turtle as t
from random import randint as rint
t.shape("turtle")
t.pensize(5)
t.colormode(255)
t.bgcolor("black")
t.tracer(False)
for x in range(700):t.color(rint(0,255),rint(0,255),rint(0,255))t.circle(2*(1+x/4),5)t.speed(30)t.tracer(True)

3.绘制小黄人


import turtle
t = turtle.Turtle()
wn = turtle.Screen()
turtle.colormode(255)
t.hideturtle()
t.speed(10)
t.penup()
t.pensize(4)
t.goto(100,0)
t.pendown()
t.left(90)
t.color((0,0,0),(255,255,0))
#身体绘制上色
t.begin_fill()
t.forward(200)
t.circle(100,180)
t.forward(200)
t.circle(100,180)
t.end_fill()
#右眼睛绘制上色
t.pensize(12)
t.penup()
t.goto(-100,200)
t.pendown()
t.right(100)
t.circle(500,23)t.pensize(3)
t.penup()
t.goto(0,200)
t.pendown()
t.seth(270)
t.color("black","white")
t.begin_fill()
t.circle(30)
t.end_fill()t.penup()
t.goto(15,200)
t.pendown()
t.color("black","black")
t.begin_fill()
t.circle(15)
t.end_fill()t.penup()
t.goto(35,205)
t.color("black","white")
t.begin_fill()
t.circle(5)
t.end_fill()
#左眼睛绘制上色
t.pensize(3)
t.penup()
t.goto(0,200)
t.pendown()
t.seth(90)
t.color("black","white")
t.begin_fill()
t.circle(30)
t.end_fill()t.penup()
t.goto(-15,200)
t.pendown()
t.color("black","black")
t.begin_fill()
t.circle(15)
t.end_fill()t.penup()
t.goto(-35,205)
t.color("black","white")
t.begin_fill()
t.circle(5)
t.end_fill()#嘴绘制上色
t.penup()
t.goto(-20,100)
t.pendown()
t.seth(270)
t.color("black","white")
t.begin_fill()
t.circle(20,180)
t.left(90)
t.forward(40)
t.end_fill()#裤子绘制上色
t.penup()
t.goto(-100,0)
t.pendown()
t.seth(0)
t.color("black","blue")
t.begin_fill()
t.forward(20)
t.left(90)
t.forward(40)
t.right(90)
t.forward(160)
t.right(90)
t.forward(40)
t.left(90)
t.forward(20)
t.seth(270)
t.penup()
t.goto(-100,0)
t.circle(100,180)
t.end_fill()#左裤子腰带
t.penup()
t.goto(-70,20)
t.pendown()
t.color("black","blue")
t.begin_fill()
t.seth(45)
t.forward(15)
t.left(90)
t.forward(60)
t.seth(270)
t.forward(15)
t.left(40)
t.forward(50)
t.end_fill()
t.left(180)
t.goto(-70,30)
t.dot()#右裤腰带
t.penup()
t.goto(70,20)
t.pendown()
t.color("black","blue")
t.begin_fill()
t.seth(135)
t.forward(15)
t.right(90)
t.forward(60)
t.seth(270)
t.forward(15)
t.right(40)
t.forward(50)
t.end_fill()t.left(180)
t.goto(70,30)t.dot()#脚
t.penup()
t.goto(4,-100)
t.pendown()
t.seth(270)
t.color("black","black")
t.begin_fill()
t.forward(30)
t.left(90)
t.forward(40)
t.seth(20)
t.circle(10,180)
t.circle(400,2)
t.seth(90)
t.forward(20)
t.goto(4,-100)
t.end_fill()t.penup()
t.goto(-4,-100)
t.pendown()
t.seth(270)
t.color("black","black")
t.begin_fill()
t.forward(30)
t.right(90)
t.forward(40)
t.seth(20)
t.circle(10,-225)
t.circle(400,-3)
t.seth(90)
t.forward(21)
t.goto(-4,-100)
t.end_fill()#左手
t.penup()
t.goto(-100,50)
t.pendown()
t.seth(225)
t.color("black","yellow")
t.begin_fill()
t.forward(40)
t.left(90)
t.forward(35)
t.seth(90)
t.forward(50)
t.end_fill()
#右手
t.penup()
t.goto(100,50)
t.pendown()
t.seth(315)
t.color("black","yellow")
t.begin_fill()
t.forward(40)
t.right(90)
t.forward(36)
t.seth(90)
t.forward(50)
t.end_fill()#
t.penup()
t.goto(0,-100)
t.pendown()
t.forward(30)#
t.penup()
t.goto(0,-20)
t.pendown()
t.color("yellow")
t.begin_fill()
t.seth(45)
t.forward(20)
t.circle(10,180)
t.right(90)
t.circle(10,180)
t.forward(20)
t.end_fill()#
t.penup()
t.color("black")
t.goto(-100,-20)
t.pendown()
t.circle(30,90)t.penup()
t.goto(100,-20)
t.pendown()
t.circle(30,-90)
#头顶
t.penup()
t.goto(2,300)
t.pendown()
t.begin_fill()
t.seth(135)
t.circle(100,40)
t.end_fill()t.penup()
t.goto(2,300)
t.pendown()
t.begin_fill()
t.seth(45)
t.circle(100,40)
t.end_fill()

【python绘图库turtle实战】使用python绘图库turtle绘制:太阳花、彩虹线与小黄人【含完整源码】相关推荐

  1. 区块链项目实战 - 使用以太坊/智能合约solidity,全栈开发区块链借贷记账小应用,含完整源码

    本文使用区块链平台以太坊+智能合约实现一个区块链记账的功能,具体为: 借款人和贷款人以及数额被记录在区块链中.使用区块链地址来表示借款人或者贷款人. 若一个借款人多次向一个贷款人借钱,更新所有的数额之 ...

  2. Python实现修改图片分辨率(含完整源码)

    Python实现修改图片分辨率(含完整源码) 在我们日常的工作和学习中,经常需要处理图片.有时候,我们可能需要修改图片的分辨率,以适应不同的需求.本文将介绍如何使用Python来实现修改图片的分辨率, ...

  3. Python编程:打造太空入侵者游戏(含完整源码)

    Python编程:打造太空入侵者游戏(含完整源码) 太空入侵者这款游戏经典得让人不能忘怀,而Python语言的简单易学.快速开发的特性,使其成为实现该游戏的最好选择.在本篇文章中,我们将为读者呈现如何 ...

  4. python turtle绘图-案例集锦(小猪佩奇、哆啦A梦、小黄人、樱花树、皮卡丘、汉诺塔、高达、星空等)

    1.小猪佩奇: import turtle as t t.pensize(4) t.hideturtle() t.colormode(255) t.color((255, 155, 192), &qu ...

  5. 【python数据分析】对淘商品类母婴购物数据进行分析(含完整源码)

    前言 嗨喽,大家好呀~这里是爱看美女的茜茜呐 又到了学Python时刻~ 一.数据集 ​ 今天我们来看一个来着阿里云天池的数据集:淘母婴购物数据,有两个csv文件: 1.mum_baby.csv 它包 ...

  6. Python 爬取北京二手房数据,分析北漂族买得起房吗?(附完整源码)

    来源:CSDN 本文约3500字,建议阅读9分钟. 本文根据Python爬取了赶集网北京二手房数据,R对爬取的二手房房价做线性回归分析,适合刚刚接触Python&R的同学们学习参考. 房价高是 ...

  7. 使用python 采集某网站全站美女图片 ,这么好看得图还不学起来(含完整源码)

    本次目的: python 抓取某某站图片 本次亮点: 系统性分析页面 多页面数据解析 海量图片数据保存 开发环境 & 第三方模块: 解释器版本 >>> python 3.8 ...

  8. 美女如何无水印下载?python带你批量采集(含完整源码)

    环境介绍: python 3.8 解释器 pycharm 2021专业版 >>> 激活码 编辑器 谷歌浏览器 谷歌驱动 selenium >>> 驱动 >&g ...

  9. Python批量采集商品数据并使用多线程(含完整源码)

    前言 嗨喽,大家好,这里是魔王~ 本次目的: Python批量采集商品数据 知识点: 爬虫基本流程 非结构化数据解析 csv数据保存 线程池的使用 开发环境: python 3.8 pycharm r ...

最新文章

  1. zoj 2972 Hurdles of 110m (DP)
  2. OpenCV的滑块与回调函数
  3. php随机数字总和固定,php 随机生成固定长度整数、各种服务器请求方法
  4. 赞!史上最强音视频下载神器youtube-dl回归,GitHub75k星
  5. ReentrantLock可重入锁
  6. Directed Minimum Spanning Tree: Chu-Liu/Edmonds Algorithm
  7. 计算机考研复试面试问题总结——数据结构篇(含答案)
  8. java怎么实现读取文件_Java读取文件的简单实现方法
  9. camera link心得
  10. 联想Thinkpad sl400 7HC入手感觉
  11. 甘肃人社生物识别认证系统服务器,甘肃人社生物识别认证系统
  12. 物联网、大数据和云计算的基本关系和应用
  13. 2021年山东省职业院校技能大赛中职组“网络安全”赛项规程
  14. 21. 查询表sc——查询平均成绩大于等于90分的学生学号和平均成绩
  15. Android Studio提示 Cannot load key store: Keystore was tampered with, or password was incorre
  16. QQ安全检查未通过,禁止下载该文件
  17. 5-TAMRA标记LYS赖氨酸,5-TAMRA-Lysine结构式及光谱图分享
  18. 解析dump的几种方式
  19. SQL截取字符串(substring与patindex的使用)
  20. 微信开发者工具如何模拟调试扫描小程序二维码功能

热门文章

  1. 急性肠胃炎经常找上门?多数是因为冰箱里的不洁食物所致
  2. 用VBS脚本处理替换文本中的字符
  3. 实锤了!程序员喜提新头衔,瞬间破防!!
  4. 用Python帮我写一段新年烟花代码
  5. 程序员 各种PDF格式电子书--免费网盘资源
  6. tcc php,64位Linux环境安装PHP TCC 扩展方法
  7. 人教版小学语文-课文朗读
  8. 2022年湖南省一级注册建筑师建筑材料与构造练习题及答案
  9. Java 实现图片或文件在线预览及下载
  10. 使用dom4j解析xml_使用dom4j解析XML