一,采用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库)的更多相关文章

  1. Python 【绘制图及turtle库的使用】

    前言 最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,整理了一下,挑了一些觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~赶快去试一下吧) one ...

  2. 【python画圆】pip安装库时出现Read timed out.解决办法

    昨天第一次用python画圆,当时并没有安装numpy库(导入数据包)和matplotlib库(导入图形包),于是尝试用pip安装库 首先,我先更新了pip,如下图: 顺便附上成功截图: 然后安装nu ...

  3. Python画各种 3D 图形Matplotlib库

    回顾 2D 作图 用赛贝尔曲线作 2d 图.此图是用基于 Matplotlib 的 Path 通过赛贝尔曲线实现的,有对赛贝尔曲线感兴趣的朋友们可以去学习学习,在 matplotlib 中,figur ...

  4. Python编程练习:使用 turtle 库完成玫瑰花的绘制

    绘制效果: 源代码: import turtle # 设置初始位置 turtle.penup() turtle.left(90) turtle.fd(200) turtle.pendown() tur ...

  5. Python编程练习:使用 turtle 库完成叠边形的绘制

    绘制效果: 源代码: # 叠边形 import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-100) turtle.l ...

  6. Python编程练习:使用 turtle 库完成正方形的绘制

    绘制效果: 源代码: # 正方形 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.pendown() turt ...

  7. Python编程练习:使用 turtle 库完成六边形的绘制

    绘制效果: 源代码: # 六边形 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.pendown() turt ...

  8. 一篇文教你使用python Turtle库画出“精美碎花小清新风格树”快来拿代码!

    Turtle库手册可以查询查询 python图形绘制库turtle中文开发文档及示例大全,手册中现有示例,不需要自己动手就可以查看演示. 使用Turtle画树,看了一下网上的代码,基本上核心的方法是使 ...

  9. python turtle库的几个小demo

    一.先上图 一个同切圆和五角星 上代码 import turtle #同切圆 turtle.pensize(2) turtle.circle(10) turtle.circle(40) turtle. ...

随机推荐

  1. maven 私服同步无法获取依赖的pom.xml的依赖

    项目中引入了依赖: <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hado ...

  2. poj 3525

    多边形内最大半径圆. 哇没有枉费了我自闭了这么些天,大概五天前我看到这种题可能毫无思路抓耳挠腮举手投降什么的,现在已经能1A了哇. 还是先玩一会计算几何,刷个几百道 嗯这个半平面交+二分就阔以解决.虽 ...

  3. linux操作2

    第2天 linux操作系统的目录结构 bin   #可执行程序的安装目录,命令boot #系统启动引导目录dev #设备目录,deviceetc #软件配置文件目录home #用户的家目录lib #系 ...

  4. CF1B Spreadsheets

    题意翻译 人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统: 第一列被标为A,第二列为B,以此类推,第26列为Z.接下来为由两个字母构成的列号: 第27列为AA,第28列为AB... ...

  5. jquery 倒计时

    今天让我公司前端大神,李杨哥,给做了一个jquery倒计时功能  很牛逼 看下面的效果图 这个倒计时是需要传值的,看效果代码讲解  百度云盘 ,压缩包永久有效  链接: https://pan.bai ...

  6. Java语言基础之方法的设计

    开发遵循原则之一: DRY原则:Don't Repeat Yourself(不要重复你自己的代码) 原因:重复意味着维护成本的增大 public static void main(String[] a ...

  7. Hibernate配置关系(申明:来源于csdn)

    hibernate中多对一.一对一.一对多.多对多的配置方法 地址:http://blog.csdn.net/communicate_/article/details/8445437

  8. ELK之使用filebeat收集系统数据及其他程序并生成可视化图表

    当您要面对成百上千.甚至成千上万的服务器.虚拟机和容器生成的日志时,请告别 SSH 吧.Filebeat 将为您提供一种轻量型方法,用于转发和汇总日志与文件,让简单的事情不再繁杂. 1,安装fileb ...

  9. 基于bootstrap-treeview做的一个漂亮的无限分类树层级联动菜单

    2017年12月11日09:59:15 因为工作需要把原来的bootstrap-treeview做了一些小改动,方便后台开发人员使用 最终效果,看起来还行,但是其实不是特别友好对用户来说,但是对开发者 ...

  10. Luogu 1086 - 花生采摘 - [简单模拟]

    题目链接:https://www.luogu.org/problemnew/show/P1086 题目描述鲁宾逊先生有一只宠物猴,名叫多多.这天,他们两个正沿着乡间小路散步,突然发现路边的告示牌上贴着 ...