python画奥运五环小结

您所在的位置:网站首页 利用turtle库绘制奥运五环 python画奥运五环小结

python画奥运五环小结

2024-07-16 17:56| 来源: 网络整理| 查看: 265

Turtle库是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x、纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的路径上绘制了图形。

效果图:

#奥运五环

import turtle

turtle.setup(1.0,1.0) #设置窗口大小

turtle.title("奥运五环")

#蓝圆

turtle.penup()

turtle.right(90)

turtle.forward(-50)

turtle.left(90)

turtle.forward(-200)

turtle.pendown()

turtle.pensize(10)

turtle.color("blue")

turtle.circle(100)

#黑圆

turtle.penup()

turtle.forward(250)

turtle.pendown()

turtle.pensize(10)

turtle.color("black")

turtle.circle(100)

#红圆

turtle.penup()

turtle.forward(250)

turtle.pendown()

turtle.pensize(10)

turtle.color("red")

turtle.cir



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3