chaigang 2020-03-14
------------恢复内容开始------------
黄边五角星
import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill() for i in range(6): turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.left(72) turtle.end_fill() turtle.hideturtle() #隐藏画笔 turtle.done() #结束绘制
同心圆
import turtle s = eval(input()) j = eval(input()) turtle.pencolor(input()) for i in range(j + 1): turtle.penup() turtle.goto(0,-i*20) turtle.pendown() turtle.circle(s*i,360) turtle.done()
渐变的圆
import turtle n = eval(input("请输入一个大于等于三且小于十的整数:")) turtle.penup() turtle.fd(-500) turtle.fillcolor("yellow") turtle.pencolor("blue") turtle.pendown() turtle.pensize(3) turtle.begin_fill() for i in range(n): turtle.circle(50,steps = i+3) turtle.fd(100) turtle.circle(50,360) turtle.end_fill() turtle.hideturtle()
叠加三角形
import turtle turtle.penup() turtle.fd(75) turtle.right(60) turtle.fd(150) turtle.pendown() for i in range(3): turtle.right(120) turtle.fd(300) turtle.penup() turtle.right(120) turtle.fd(150) turtle.right(60) turtle.pendown() for i in range(3): turtle.fd(150) turtle.right(120) turtle.hideturtle() turtle.done()
奥运五环
import turtle coorA = (-110,0,110,-55,55) coorB = (-25,-25,-25,-75,-75) my_colors = ("red","blue","green","yellow","black") turtle.pensize(5) for i in range(5): turtle.penup() turtle.goto(coorA[i],coorB[i]) turtle.pendown() turtle.color(my_colors[i%len(my_colors)]) turtle.circle(45,360) turtle.hideturtle() turtle.done()
太极图
import turtle turtle.fillcolor("black") turtle.begin_fill() turtle.circle(100, 180) turtle.circle(50, -180) turtle.circle(-50, -180) turtle.end_fill() turtle.penup() turtle.right(90) turtle.fd(40) turtle.pendown() turtle.right(90) turtle.fillcolor("white") turtle.begin_fill() turtle.circle(10, 360) turtle.end_fill() turtle.right(90) turtle.fd(40) turtle.right(90) turtle.circle(-100, 180) turtle.right(90) turtle.penup() turtle.fd(40) turtle.fillcolor("black") turtle.begin_fill() turtle.pendown() turtle.circle(10,360) turtle.end_fill() turtle.hideturtle() turtle.done()
国际棋盘
import turtle as t a = eval(input()) for i in range(8): for j in range(8): t.penup() t.goto(i*a, j*a) t.pendown() t.begin_fill() if(i+j)%2 ==0: t.color("white") else: t.color("black") for k in range(4): t.fd(a) t.right(90) t.end_fill() t.pencolor("black") t.fd(a) for n in range(4): t.right(90) t.fd(a*8) t.hideturtle() t.done()