当前位置:   article > 正文

请用python写出奥运五环的绘图程序,20200929 008.海龟绘图_画出奥运五环图

请用python写出奥运五环的绘图程序,20200929 008.海龟绘图_画出奥运五环图

绘制奥运五环标记

源码:

#绘制奥运五环

import turtle

turtle.width(10)

turtle.color("blue")

turtle.circle(50)

turtle.penup()

turtle.goto(120,0)

turtle.pendown()

turtle.color("black")

turtle.circle(50)

turtle.penup()

turtle.goto(240,0)

turtle.pendown()

turtle.color("red")

turtle.circle(50)

turtle.penup()

turtle.goto(60,-50)

turtle.pendown()

turtle.color("yellow")

turtle.circle(50)

turtle.penup()

turtle.goto(180,-50)

turtle.pendown()

turtle.color("green")

turtle.circle(50)

运行结果:

6491ae8997e06e0d492a1668d9b38ddb.png

本章实操作业

1. 建立 Python 开发环境,并完成第一个 Python 程序。将整个过程使用图文描述出来。

2. 根据老师代码,完成奥运五环的绘图程序

3. 使用海龟绘图,输出四个矩形:

ee6ace6fa035a14e53c03eda784e50d3.png

源码:

#使用海龟绘图绘制4个矩形

import turtle

turtle.showturtle() #显示箭头

#绘制4个阴影

turtle.width(4)

turtle.color("#e9e7ef") #颜色查编程颜色代码,html的颜色代码通用

turtle.penup()

turtle.goto(5,-5)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(135,-5)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(5,-145)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(135,-145)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

#绘制4个深红色矩形

turtle.width(2)

turtle.color("#be002f") #颜色查编程颜色代码,html的颜色代码通用

turtle.penup()

turtle.goto(0,0)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(130,0)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(0,-140)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.penup()

turtle.goto(130,-140)

turtle.pendown()

turtle.forward(100)

turtle.left(90) #箭头左转90度

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

turtle.forward(100)

turtle.left(90)

原文链接:https://blog.csdn.net/MinskyYi/article/details/108868636

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/179842
推荐阅读
相关标签
  

闽ICP备14008679号