用python画小王八裤(turtle库)
一,采用Python语言如何画一朵玫瑰花
工具/原料
Python语言包
Win10
一、 准备
1、 打开界面:
打开python

2、 创建文件

二、 编程
1、 编写画图:
from turtle import *
#global pen and speed
pencolor("black")
fillcolor("red")
speed(50)
s=0.15
#init poistion
penup()
goto(0,600*s)
pendown()
begin_fill()
circle(200*s,30)
for i in range(60):
lt(1)
circle(50*s,1)
circle(200*s,30)
for i in range(4):
lt(1)
circle(100*s,1)
circle(200*s,50)
for i in range(50):
lt(1)
circle(50*s,1)
circle(350*s,65)
for i in range(40):
lt(1)
circle(70*s,1)
circle(150*s,50)
for i in range(20):
rt(1)
circle(50*s,1)
circle(400*s,60)
for i in range(18):
lt(1)
circle(50*s,1)
fd(250*s)
rt(150)
circle(-500*s,12)
lt(140)
circle(550*s,110)
lt(27)
circle(650*s,100)
lt(130)
circle(-300*s,20)
rt(123)
circle(220*s,57)
end_fill()
lt(120)
fd(280*s)
lt(115)
circle(300*s,33)
lt(180)
circle(-300*s,33)
for i in range(70):
rt(1)
circle(225*s,1)
circle(350*s,104)
lt(90)
circle(200*s,105)
circle(-500*s,63)
penup()
goto(170*s,-330*s)
pendown()
lt(160)
for i in range(20):
lt(1)
circle(2500*s,1)
for i in range(220):
rt(1)
circle(250*s,1)
fillcolor('green')
penup()
goto(670*s,-480*s)
pendown()
rt(140)
begin_fill()
circle(300*s,120)
lt(60)
circle(300*s,120)
end_fill()
penup()
goto(180*s,-850*s)
pendown()
rt(85)
circle(600*s,40)
penup()
goto(-150*s,-1300*s)
pendown()
begin_fill()
rt(120)
circle(300*s,115)
lt(75)
circle(300*s,100)
end_fill()
penup()
goto(430*s,-1370*s)
pendown()
rt(30)
circle(-600*s,35)
done()
2、保存脚本

三、 查看效果
1.运行代码:
回到脚本编辑页,单击“run”-“run module”,如图所示。

2、 执行效果:
我们可以看到我们画图的过程,这是其中的一个画图片段。

3、 结果:
如图,我们画出了一朵美丽的玫瑰花

二、小太阳
1、以下的准备顺序同上,所以就不多说啦
2、以下是代码
from turtle import*
color('red','yellow’)
begin_fill()
while True:
forward(300)
left(170)
if abs(pos())<1:
break
end_fill()
done()
3、查看效果:

以上只是一个小朋友的作业,如果错误或雷同,请指教!
用python画小王八裤(turtle库)的更多相关文章
- Python 【绘制图及turtle库的使用】
前言 最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,整理了一下,挑了一些觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~赶快去试一下吧) one ...
- 【python画圆】pip安装库时出现Read timed out.解决办法
昨天第一次用python画圆,当时并没有安装numpy库(导入数据包)和matplotlib库(导入图形包),于是尝试用pip安装库 首先,我先更新了pip,如下图: 顺便附上成功截图: 然后安装nu ...
- Python画各种 3D 图形Matplotlib库
回顾 2D 作图 用赛贝尔曲线作 2d 图.此图是用基于 Matplotlib 的 Path 通过赛贝尔曲线实现的,有对赛贝尔曲线感兴趣的朋友们可以去学习学习,在 matplotlib 中,figur ...
- Python编程练习:使用 turtle 库完成玫瑰花的绘制
绘制效果: 源代码: import turtle # 设置初始位置 turtle.penup() turtle.left(90) turtle.fd(200) turtle.pendown() tur ...
- Python编程练习:使用 turtle 库完成叠边形的绘制
绘制效果: 源代码: # 叠边形 import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-100) turtle.l ...
- Python编程练习:使用 turtle 库完成正方形的绘制
绘制效果: 源代码: # 正方形 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.pendown() turt ...
- Python编程练习:使用 turtle 库完成六边形的绘制
绘制效果: 源代码: # 六边形 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.pendown() turt ...
- 一篇文教你使用python Turtle库画出“精美碎花小清新风格树”快来拿代码!
Turtle库手册可以查询查询 python图形绘制库turtle中文开发文档及示例大全,手册中现有示例,不需要自己动手就可以查看演示. 使用Turtle画树,看了一下网上的代码,基本上核心的方法是使 ...
- python turtle库的几个小demo
一.先上图 一个同切圆和五角星 上代码 import turtle #同切圆 turtle.pensize(2) turtle.circle(10) turtle.circle(40) turtle. ...
随机推荐
- Solve Docker for Windows error: docker detected, A firewall is blocking file Sharing between Windows and the containers
被这个“分享硬盘”问题烦了我好几个小时,终于在一个叫Marco Mansi外国人博客上找到解决方法了,真的很无奈 https://blog.olandese.nl/2017/05/03/solve-d ...
- 用dx生成dex时遇到class name does not match path
前言 用dx生成dex时遇到class name (Hello) does not match path这个问题还弄了挺久,这里就简单的记录一下. 步骤 首先是dx工具是在Android的SDK里面的 ...
- oracle索引分类
参考文档:https://wenku.baidu.com/view/d4d6ee1ba76e58fafab00336.html https://blog.csdn.net/u010719917/art ...
- mongoDB数据库插入数据时报错:db.collection is not a function
nodejs连接mongodb插入数据时,发现mongoDB报错:db.collection is not a function.解决方法: 1.npm下载mongodb2.x.x版本替换3.x.x ...
- xilink 烧写flash
no 右键
- 1.7Oob 方法重载和成员变量,局部变量,构造方法
1:方法调用,如果值有参方法,必须传递实际参数. 2:方法定义了多少个参数,传递的实际参数就 必须有多少个, 方法的作用:1:描述某个类的作用,2:软件的复用 这个复用率低,作用小,价值很低: 3:
- HTML轮播图实现(前后端分离)
1,首先前后端分离用到了3个插件 2,异步请求后端获取数据库图片地址(图片名字) //图片轮播 axios({ url:'http://127.0.0.1:8000/userctrl/image', ...
- Spring Boot 入门day01
一.Spring Boot入门 1.Spring Boot简介 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特 ...
- (转载)Java Map中的Value值如何做到可以为任意类型的值
转载地址:http://www.importnew.com/15556.html 如有侵权,请联系作者及时删除. 搬到我的博客来,有空细细品味,把玩. 本文由 ImportNew - shut ...
- C#基础加强(4)之秒懂IL、CTS、CLS和CLR
IL(Intermediate Language) 中间语言..Net 平台下不只有 C# 语言,还有 VB.Net.F# 等语言.IL 是程序最终编译的可执行二进制代码(托管代码),类似于 Java ...