_怎样在python里让海龟画图抬笔落笔?

python海龟基础教程2020-09-25 09:07:48人已围观

求一份小甲鱼的《零基础入门学习Python》视频教程

本系列教程面向零基础的同学,个深入浅出俗易懂的Python3视频教程。

适用

完全零基础入门,不需要任何前置知识。

教程概述

前半部分主要讲解Python3的语法特性,后半部分着重讲解Python3在爬虫、Tkinter、Pygame游戏开发等实例上的应用。整个系列共16个章节,前边13个章节从一个小游戏引入Python,逐步介绍Python的语法以及语言特色。最后3个章节为案例的演示,是前边内容的总结和提高。

Python turtle海龟制图 求代码

# coding:utf-8

import turtle as t

# 绘制佩奇

# =======================================

t.pensize(4)

t.hideturtle()

t.colormode(255)

t.color((255, 155, 192), "pink")

t.setup(840, 500)

t.speed(10)

# 鼻子

t.pu()

t.goto(-100, 100)

t.pd()

t.seth(-30)

t.begin_fill()

a = 0.4

for i in range(120):

if 0 <= i < 30 or 60 <= i < 90:

a = a 0.08

t.lt(3) # 向左转3度

t.fd(a) # 向a的步长

else:

a = a - 0.08

t.lt(3)

t.fd(a)

t.end_fill()

t.pu()

t.seth(90)

t.fd(25)

t.seth(0)

t.fd(10)

t.pd()

t.pencolor(255, 155, 192)

t.seth(10)

t.begin_fill()

t.circle(5)

t.color(160, 82, 45)

t.end_fill()

t.pu()

t.seth(0)

t.fd(20)

t.pd()

t.pencolor(255, 155, 192)

t.seth(10)

t.begin_fill()

t.circle(5)

t.color(160, 82, 45)

t.end_fill()

# 头

t.color((255, 155, 192), "pink")

t.pu()

t.seth(90)

t.fd(41)

t.seth(0)

t.fd(0)

t.pd()

t.begin_fill()

t.seth(180)

t.circle(300, -30)

t.circle(100, -60)

t.circle(80, -100)

t.circle(150, -20)

t.circle(60, -95)

t.seth(161)

t.circle(-300, 15)

t.pu()

t.goto(-100, 100)

t.pd()

t.seth(-30)

a = 0.4

for i in range(60):

if 0 <= i < 30 or 60 <= i < 90:

a = a 0.08

t.lt(3) # 向3度

t.fd(a) # 向前走a的步长

else:

a = a - 0.08

t.lt(3)

t.fd(a)

t.end_fill()

# 耳朵

t.color((255, 155, 192), "pink")

t.pu()

t.seth(90)

t.fd(-7)

t.seth(0)

t.fd(70)

t.pd()

t.begin_fill()

t.seth(100)

t.circle(-50, 50)

t.circle(-10, 120)

t.circle(-50, 54)

t.end_fill()

t.pu()

t.seth(90)

t.fd(-12)

t.seth(0)

t.fd(30)

t.pd()

t.begin_fill()

t.seth(100)

t.circle(-50, 50)

t.circle(-10, 120)

t.circle(-50, 56)

t.end_fill()

#

t.color((255, 155, 192), "white")

t.pu()

t.seth(90)

t.fd(-20)

t.seth(0)

t.fd(-95)

t.pd()

t.begin_fill()

t.circle(15)

t.end_fill()

t.color("black")

t.pu()

t.seth(90)

t.fd(12)

t.seth(0)

t.fd(-3)

t.pd()

t.begin_fill()

t.circle(3)

t.end_fill()

t.color((255, 155, 192), "white")

t.pu()

t.seth(90)

t.fd(-25)

t.seth(0)

t.fd(40)

t.pd()

t.begin_fill()

t.circle(15)

t.end_fill()

t.color("black")

t.pu()

t.seth(90)

t.fd(12)

t.seth(0)

t.fd(-3)

t.pd()

t.begin_fill()

t.circle(3)

t.end_fill()

# 腮

t.color((255, 155, 192))

t.pu()

t.seth(90)

t.fd(-95)

t.seth(0)

t.fd(65)

t.pd()

t.begin_fill()

t.circle(30)

t.end_fill()

# 嘴

t.color(239, 69, 19)

t.pu()

t.seth(90)

t.fd(15)

t.seth(0)

t.fd(-100)

t.pd()

t.seth(-80)

t.circle(30, 40)

t.circle(40, 80)

# 身体

t.color("red", (255, 99, 71))

t.pu()

t.seth(90)

t.fd(-20)

t.seth(0)

t.fd(-78)

t.pd()

t.begin_fill()

t.seth(-130)

t.circle(100, 10)

t.circle(300, 30)

t.seth(0)

t.fd(230)

t.seth(90)

t.circle(300, 30)

t.circle(100, 3)

t.color((255, 155, 192), (255, 100, 100))

t.seth(-135)

t.circle(-80, 63)

t.circle(-150, 24)

t.end_fill()

# 手

t.color((255, 155, 192))

t.pu()

t.seth(90)

t.fd(-40)

t.seth(0)

t.fd(-27)

t.pd()

t.seth(-160)

t.circle(300, 15)

t.pu()

t.seth(90)

t.fd(15)

t.seth(0)

t.fd(0)

t.pd()

t.seth(-10)

t.circle(-20, 90)

t.pu()

t.seth(90)

t.fd(30)

t.seth(0)

t.fd(237)

t.pd()

t.seth(-20)

t.circle(-300, 15)

t.pu()

t.seth(90)

t.fd(20)

t.seth(0)

t.fd(0)

t.pd()

t.seth(-170)

t.circle(20, 90)

# 脚

t.pensize(10)

t.color((240, 128, 128))

t.pu()

t.seth(90)

t.fd(-75)

t.seth(0)

t.fd(-180)

t.pd()

t.seth(-90)

t.fd(40)

t.seth(-180)

t.color("black")

t.pensize(15)

t.fd(20)

t.pensize(10)

t.color((240, 128, 128))

t.pu()

t.seth(90)

t.fd(40)

t.seth(0)

t.fd(90)

t.pd()

t.seth(-90)

t.fd(40)

t.seth(-180)

t.color("black")

t.pensize(15)

t.fd(20)

# 尾巴

t.pensize(4)

t.color((255, 155, 192))

t.pu()

t.seth(90)

t.fd(70)

t.seth(0)

t.fd(95)

t.pd()

t.seth(0)

t.circle(70, 20)

t.circle(10, 330)

t.circle(70, 30)

t.done()

怎样在python里让海龟画图抬笔落笔?

import turtle

t= turtle.Pen()

t.penup() #抬笔

t.pendown() #落笔

版权声明:本站所有文章皆为原创,欢迎转载或转发,请保留网站地址和作者信息。

python起笔落笔__怎样在python里让海龟画图抬笔落笔?相关推荐

  1. python起笔落笔_Python赤橙黄绿青蓝紫(落笔抬笔打点)教学演示幻灯片.pyw

    1 """ 2 第十课 赤橙黄绿青蓝紫(落笔抬笔打点)3 """ 4 from sprites import * 5 6 s = '第十课 ...

  2. 巴斯光年python turtle绘图__附源代码

    巴斯光年python turtle绘图__附源代码 本文目录: 一.python turtle海龟绘图效果图 写在前面的题外话 二.绘图人物简介 三.代码演示方法和代码命令解释 四.怎么才能正常运行p ...

  3. 简学Python第二章__巧学数据结构文件操作

    Python第二章__巧学数据结构文件操作 欢迎加入Linux_Python学习群  群号:478616847 目录: 列表 元祖 索引 字典 序列 文件操作 编码与文件方法 本站开始将引入一个新的概 ...

  4. notepad怎么设置python为环境变量_在Notepad++里配置python环境

    1.首先在语言里选择Python 2.然后点击运行,在弹出的对话框里输入: cmd /k cd /d "$(CURRENT_DIRECTORY)" & python &qu ...

  5. python实现AES加解密文档里英文字符串

    python实现AES加解密文档里英文文章 AES加解密文档里英文字符串 英文文档中也包含了空格与回车符 加密过程 首先读取文件中的内容 将文档中的内容读取,然后将其赋予你申请的变量 在我的实验中我的 ...

  6. Python将PPT中所有文本框里的文字提取出来

    Python将PPT中所有文本框里的文字提取出来 我用了正则表达式,理论上用用可以解析xml格式的都可以,如Beautiful,pandas等. 直接上代码 import os import re s ...

  7. python类装饰器详解-Python类中的装饰器在当前类中的声明与调用详解

    我的Python环境:3.7 在Python类里声明一个装饰器,并在这个类里调用这个装饰器. 代码如下: class Test(): xx = False def __init__(self): pa ...

  8. python学习路线----天池龙珠计划Python训练营task1~3

    本文对python语法的查漏补缺,自用,在此对python中不常使用或者是容易遗忘的知识点做出归纳.龙珠训练营可以让同学入门Python深度学习或者数据分析方向. Task1: 如果对一个列表,既要遍 ...

  9. python的使用说明_Python教程:Python中__init__.py的使用用法说明

    Python中的Module是比较重要的概念.常见的情况是,事先写好一个.py文 件,在另一个文件中需要import时,将事先写好的.py文件拷贝 到当前目录,或者是在sys.path中增加事先写好的 ...

最新文章

  1. class括号里的object_Python入门 类class 基础篇
  2. Python 之 matplotlib (十)Image
  3. seaborn系列 (16) | 变量关系组图pairplot()
  4. 【融云分析】选择IM云服务,需要看哪些核心技术指标?
  5. 机器学习(一)梯度下降算法的实现及过程分析
  6. 机器人多用途综合官网展示PHP单页源码
  7. 无刷新三级联动(ajax)(转)
  8. tensorflow/pytorch 设置GPU的使用
  9. Python 用下划线作为变量前缀和后缀指定特殊变量
  10. vertica中sql正则表达式
  11. Chrome下载离线安装包的方法
  12. 今天做了一下chinaitlab上面的CCNA试题!
  13. 双十一大战前瞻:拼多多京东苏宁纷纷放大招,谁能挑战阿里C位?
  14. 《Multi-Stream Gated and Pyramidal Temporal Convolutional Neural Networksfor Audio-Visual Speech Se》
  15. sd卡数据恢复源码android,SD卡数据恢复非常简单,想学的看过来!
  16. 京东获取商品历史价格信息 API
  17. 社招两年半10个公司28轮面试面经
  18. 李斌转让5000万股私人持有股份 完成蔚来用户信托设立
  19. 常见程序设计及编程开发
  20. iOS 图片裁剪(用户头像裁剪)

热门文章

  1. i.MX537多媒体应用处理器简介
  2. Vuex存储公共的数据步骤
  3. 让镜头数量之争终结!Holga iPhone外壳暴力集成10个镜头
  4. 超市零售数据分析-大数据项目
  5. 大数据工具Maxwell的使用
  6. NVIDIA Jetson TX2 简单介绍
  7. PID控制算法基础介绍
  8. Chrome浏览器插件Postman用法简介-Http请求模拟工具
  9. python rot13解密_ROT13 加密与解密
  10. vue init webpack Travel项目初始化失败的解决办法