旋转的赫兹_三角函数与海龟画图示例程序

"""
   旋转的赫兹.py
   三角函数与海龟画图示例程序
"""

import math
from turtle import Turtle, Screen

screen = Screen()
screen.bgcolor("black")
screen.title("旋转的赫兹")
screen.tracer(0)

# 这个海龟叫萍乡
pingxiang = Turtle(visible=False)
pingxiang.pu()
pingxiang.setpos(0, 500)
pingxiang.pd()
pingxiang.setpos(0, -500)
pingxiang.pu()
pingxiang.setpos(-650, 0)
pingxiang.pd()
pingxiang.setpos(0, 0)
pingxiang.write("0", align="right", font=("Times New Roman", 14, "normal"))
pingxiang.setpos(650, 0)

# 这个海龟叫安源
anyuan = Turtle(visible=False)

for r in range(0, 600000):

    anyuan.clear()

    anyuan.pu()
    anyuan.setpos(-300 * math.cos(r * math.pi / 100), 300 * math.sin(r * math.pi / 100))
    anyuan.pd()
    anyuan.pencolor("red")

You must log in to read the rest of this article. Please log in or register as a user.