1 Star 0 Fork 0

杨成帅/turtle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
shapes.py 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
xiaoming 提交于 2019-11-17 01:44 . first commit
# This is a custom module we've made.
# Modules are files full of code that you can import into your programs.
# This one teaches our turtle to draw various shapes.
import turtle
import math
def draw_circle(turtle, color, x, y, radius):
turtle.penup()
turtle.color(color)
turtle.fillcolor(color)
turtle.goto(x, y)
turtle.pendown()
turtle.begin_fill()
turtle.circle(radius)
turtle.end_fill()
def draw_rectangle(turtle, color, x, y, width, height):
turtle.hideturtle()
turtle.penup()
turtle.color(color)
turtle.fillcolor(color)
turtle.goto(x, y)
turtle.pendown()
turtle.begin_fill()
for i in range(2):
turtle.forward(width)
turtle.left(90)
turtle.forward(height)
turtle.left(90)
turtle.end_fill()
turtle.setheading(0)
def draw_star(turtle, color, x, y, size):
turtle.penup()
turtle.color(color)
turtle.fillcolor(color)
turtle.goto(x, y)
turtle.pendown()
turtle.begin_fill()
turtle.right(144)
for i in range(5):
turtle.forward(size)
turtle.right(144)
turtle.forward(size)
turtle.end_fill()
turtle.setheading(0)
def addIcing(turtle, color, x, y):
turtle.penup()
turtle.color(color)
turtle.fillcolor(color)
turtle.goto(-x - 2, y + 10)
turtle.pendown()
turtle.begin_fill()
for z in range(-x - 3, x + 3):
turtle.goto(z, y - 10 - 10 * math.cos((z / 100) * 2 * math.pi))
turtle.goto(x + 3, y + 10)
turtle.goto(-x - 3, y + 10)
turtle.end_fill()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yang-cheng-shuai/turtle.git
git@gitee.com:yang-cheng-shuai/turtle.git
yang-cheng-shuai
turtle
turtle
master

搜索帮助