python绘图小结(2)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python绘图小结(2)相关的知识,希望对你有一定的参考价值。
参考技术A #例题1绘制一个四叶草import turtle
turtle.color("green","green")
turtle.setheading(90)
turtle.begin_fill()
for i in range(4):
turtle.circle(-100,180)
turtle.left(90)
turtle.end_fill()
turtle.done()
#例题2绘制一个四角星
import turtle
turtle.color("yellow","yellow")
turtle.begin_fill()
for i in range(4):
turtle.circle(100,90)
turtle.right(180)
turtle.end_fill()
turtle.done()
#例题3绘制一个四叶花瓣
import turtle
turtle.color("pink","pink")
turtle.begin_fill()
turtle.circle(-100,90)
turtle.right(90)
turtle.circle(-100,90)
turtle.circle(100, 90)
turtle.right(90)
turtle.circle(-100, -90)
turtle.right(90)
turtle.circle(-100, 90)
turtle.right(90)
turtle.circle(-100, 90)
turtle.circle(100, 90)
turtle.right(90)
turtle.circle(-100, -90)
turtle.end_fill()
turtle.done()
#例题4输入一个数字,绘制以该数字为边数的正多边形
import turtle
a=int(turtle.textinput("绘制正多边形","请输入边数:"))
turtle.circle(100,360,a)
turtle.done()
以上是关于python绘图小结(2)的主要内容,如果未能解决你的问题,请参考以下文章