The Python Turtle module is a library in Python that allows users to create graphic programs using turtle graphics. It provides a simple way to draw shapes, create animations, and interact with graphics in Python.
# 导入一个python的模块
import turtle
print(turtle)
turtle.fillcolor("yellow")
turtle.begin_fill()
# 向前爬行100
turtle.forward(100)
# 逆时针 向左转90度
turtle.left(90)
# 向前爬行100
turtle.forward(100)
turtle.left(135)
turtle.forward(100*1.414)
turtle.end_fill()
turtle.right(90)
# 抬起画笔 不留痕迹
turtle.up()
turtle.forward(200)
turtle.down()
# 填充一个颜色
turtle.fillcolor("pink")
# 开始填充
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
# 结束填充
turtle.end_fill()
# 启动模块
turtle.mainloop()