一、画一个太极图

import turtle as t
t.pensize(2)#设置笔画宽度
t.circle(100)#以100为半径的圆
t.circle(50, 180)
t.circle(-50, 180)
t.penup()#抬起画笔
t.goto(0, 40)#移动到绝对位置
t.pendown()#放下画笔
t.circle(10)
t.penup()
t.goto(0, 140)
t.pendown()
t.circle(10)
t.hideturtle()#隐藏画笔
t.done()

二、画一个同心圆

import turtle as t
def drawcircle(n):
t.pensize(3)
t.penup()
t.goto(0, -n)
t.pendown()
t.circle(n)
for i in range(20,80,20):
drawcircle(i)
t.hideturtle()
t.done()

三、画一个同心切

import turtle as t
for i in range(20,80,20):
t.circle(i)

四、画一个五角星

import turtle as t
t.color('red', 'red')
t.begin_fill()
for i in range(5):
t.fd(200)
t.rt(144)
t.hideturtle()
t.end_fill()
t.done()

六、画一个花瓣

import turtle as t
t.penup()
t.goto(-40,-90)
t.pendown()
t.colormode(255)
t.screensize(800,600,'white')
t.pensize(2)
t.color((255,155,192),(144,218,253))
t.begin_fill()
for i in range(4):
t.seth(90*(i+1))
t.rt(45)
t.circle(150, 90)
t.seth(-90 + i * 90
t.circle(150, 90)
t.end_fill()
t.done()

七、画一个菱形(要求根据题意使用适当函数)

import turtle as t
t.rt(30)
for i in range(2):
t.color('red')
t.fd(100)
t.rt(-60*(i+1))
for j in range(2):
t.fd(100)
t.rt(-60*(j+1))
t.hideturtle()
t.done()#使用rt函数

八、画一个多彩圆

import turtle
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'purple']
for i in range(7):
c = colors[i]
turtle.color(c, c)
turtle.begin_fill()
turtle.lt(360/7)
turtle.circle(50)
turtle.end_fill()
turtle.done()

九、后续未完...

一、佩奇(课外...)

import turtle as t
t.pensize(4)
t.colormode(255) #取色范围
t.color((255,155,192),"pink")
t.setup(840,500)
t.speed(3) #时速
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)
t.fd(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.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)
t.fd(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()#penup提笔
t.seth(90)
t.fd(40)
t.seth(0)
t.fd(90)#=forward
t.pd()#=pendown
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.hideturtle()
t.done()

海龟绘图turtle库之二级基础编程题的更多相关文章

  1. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 3. 循环

    在前面的教程中,咪博士留了一道练习题给大家—-画正方形,相信聪明的你应该已经画出来了. 下面是咪博士实现的代码. 是不是跟你的代码很像呢? import turtle turtle.forward(2 ...

  2. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 7. 条件循环

    条件循环能够让程序在条件成立时(即为真时)重复执行循环体中的语句.如果条件一直成立(即永远不会为假),则循环会一直进行下去,不会停止.如果初始时,条件不成立,则循环 1 次也不会执行.Python 中 ...

  3. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 6. 条件

    前面的教程中,我们已经可以让小海龟绘制出各种图形了.但是,所有绘图的代码都是预先编好的,程序一旦运行起来,运行结果(绘制的图形)就是固定不变的.这一节中,咪博士将教大家如何让海龟响应用户的输入. im ...

  4. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 5. 参数

    上一个教程中,咪博士带大家学习了函数的使用.例如,line_without_moving 函数,可以让海龟先画出一条线段,然后再回来起点. def line_without_moving(): tur ...

  5. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 4. 函数

    什么样的程序员才是优秀的程序员?咪博士认为“慵懒”的程序员才是真正优秀的程序员.听起来不合逻辑?真正优秀的程序员知道如何高效地工作,而不是用不止境的加班来完成工作任务.函数便是程序员高效工作的利器之一 ...

  6. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 2. 变量

    大家在中学就已经学过变量的概念了.例如:我们令 x = 100,则可以推出 x*2 = 200 试试下面这段 Python 代码 import turtle turtle.shape("tu ...

  7. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 1. 神秘朋友

    Python (Windows 下) 自带了一个非常有趣的 海龟绘图程序 (turtle),它是本系列课程的主角. 在 PyCharm 中,新建一个项目,然后在代码编辑器中输入 import turt ...

  8. Python 零基础 快速入门 趣味教程 (咪博士 海龟绘图 turtle) 0. 准备工作

    一.关于 Python Python 是全球使用人数增长最快的编程语言!它易于入门.功能强大,从 Web 后端 到 数据分析.人工智能,到处都能看到 Python 的身影. Python 有两个主要的 ...

  9. 海龟绘图turtle模块的使用

    在本章中,我们将编写简短的.简单的程序来创建漂亮的.复杂的视觉效果.为了做到这一点,我们可以使用海龟作图软件.在海龟作图中,我们可以编写指令让一个虚拟的(想象中的)海龟在屏幕上来回移动.这个海龟带着一 ...

随机推荐

  1. Failed to introspect annotated methods on class 异常

    用@enable时出现错误 Failed to introspect annotated methods on class 很可能是库和springboot版本不一致

  2. MyBatis学习资料

    中文文档:http://www.mybatis.org/mybatis-3/zh/index.html http://blog.csdn.net/neosmith/article/details/61 ...

  3. 解题(ConflictPhoneNumber--冲突的电话号码)

    题目描述 移动推出的校内网短号和亲情网短号非常方便,但在某款新手机里却出现了尴尬的bug.例如,当通讯录中包含如下号码时:1.小王:6002.小李:4676543.小张:600010输入600时,手机 ...

  4. SpringCloud Zuul网关的简单理解

    Zuul网关功能 请求路由.服务路由.请求过滤 请求路由 参数配置如下所示,所有能够配置path规则的请求,都会被zuul网关转发到对应的url上. zuul.routes.user-service. ...

  5. FOB注意事项

    1. FOB是我们作为贸易公司去联系物流公司将货送到码头,缴纳FOB cost 以后,海关安排码头的人送到船上. 2.在这之前,买方自己订船,然后发给卖方入货通知,卖方安排发货. 3.FOB cost ...

  6. android HTTP镜像

    mirrors.neusoft.edu.cn 80

  7. pytho命名规范

    1变量小写 多个单词  下划线 2 常量 全大写 3

  8. 第一个spring简单的helloworld

    spring 是一个开源的框架 也是轻量级框架 1.导入jar包 spring的版本 4.0 目录: spring-framework-4.0.0.RELEASE-libs 下的jar  spring ...

  9. 52-2018 蓝桥杯省赛 B 组模拟赛(一)java

    最近蒜头君喜欢上了U型数字,所谓U型数字,就是这个数字的每一位先严格单调递减,后严格单调递增.比如 212212 就是一个U型数字,但是 333333, 9898, 567567, 313133131 ...

  10. spring boot整合websocket

    转载自:https://www.cnblogs.com/GoodHelper/p/7078381.html 一.WebSocket简单介绍 随着互联网的发展,传统的HTTP协议已经很难满足Web应用日 ...