#Square.py
import turtle as tl
tl.color("red")
tl.forward(100)
tl.left(90)
tl.forward(100)
tl.left(90)
tl.color("green")
tl.forward(100)
tl.left(90)
tl.forward(100)

#Square_Screw.py 2111441
from turtle import *
pensize(3)
bgcolor('black')
colormode(255)
pencolor((51,204,120))
for i in range(100):
fd(i+(i*2))
left(90)
hideturtle()
done()

#FivePointStar.py 211441
from turtle import *
pensize(5)
pencolor("green")
fillcolor("red")
begin_fill()
while True:
fd(200)
right(144)
if abs(pos())<1:
break
end_fill()

这两段代码使用Python的Turtle库绘制图形。第一个程序画了一个红色和绿色相间的正方形,而第二个程序绘制了一个渐变色的圆形,颜色从浅绿到深绿。第三个程序则画了一个填充为红色的五角星,边长为200像素。所有程序都涉及到了线宽、颜色选择和角度计算。
1242

被折叠的 条评论
为什么被折叠?



