Пример #1
0
def main():
    wn = turtle_helper.make_window("lightgreen", "Letter S")
    t = turtle_helper.make_turtle("red", 2, shape="classic")
    turtle_helper.move(t, -350, 0)
    print_index_style(t, "02123475297516589", 30)

    wn.mainloop()
Пример #2
0
def main():
    wn = turtle_helper.make_window("lightgreen", "Spider")
    t = turtle_helper.make_turtle("red", 2)

    x_start, y_start = 200, 0
    radius = 100
    n = 3
    side = polygon_side_by_radius(radius, 3)
    start_angle = 90 - 180 / n

    turtle_helper.move(t, x_start, y_start)
    draw_polygon(t, n, side, start_angle)

    old_radius = radius

    while n <= 10:
        n += 1
        radius = old_radius / math.cos(math.pi / n)
        dist = radius - old_radius
        turtle_helper.move(t, t.xcor() + dist, t.ycor())
        start_angle = 90 - 180 / n
        side = polygon_side_by_radius(radius, n)
        draw_polygon(t, n, side, start_angle)

        old_radius = radius

    wn.mainloop()
Пример #3
0
def main():
    wn = turtle_helper.make_window("lightgreen", "Letter S")
    t = turtle_helper.make_turtle("red", 2, shape="classic")
    turtle_helper.move(t, -350, 0)

    font_file = "index_like_font.csv"
    font = read_font.read_font(font_file)
    # print_with_font(t, font, "02123475297516589", 30)
    print_with_font(t, font, "0123456789", 30)

    wn.mainloop()
Пример #4
0
def main():
    wn = turtle_helper.make_window("lightgreen", "Stars")

    t = turtle_helper.make_turtle("red", 2, -250, 250)
    draw_star(t, 5, 2, 230, 18 - 90)

    turtle_helper.move(t, 120, -120)
    t.color("blue")

    draw_star(t, 11, 4, 230, 0)

    wn.mainloop()
Пример #5
0
def main():
    wn = turtle_helper.make_window("lightgreen", "Smile")
    t = turtle_helper.make_turtle("black", 1, 150, 0)

    # лицо
    t.color('black', 'yellow')
    t.begin_fill()
    turtle_helper.draw_circle(t, 150, 90)
    t.end_fill()

    # глаза
    t.color('black', 'blue')
    turtle_helper.move(t, 85, 75)
    t.begin_fill()
    turtle_helper.draw_circle(t, 20, 90)
    t.end_fill()
    turtle_helper.move(t, -45, 75)
    t.begin_fill()
    turtle_helper.draw_circle(t, 20, 90)
    t.end_fill()

    # нос
    t.pensize(10)
    turtle_helper.move(t, 0, -20)
    t.color('black')
    t.forward(40)

    # рот
    turtle_helper.move(t, 80, -35)
    t.color('red')
    turtle_helper.draw_arc(t, 80, 270, 180, False)

    wn.mainloop()
Пример #6
0
def paint_square(turtle, side, x=0, y=0, angle=0):
    turtle_helper.move(turtle, x, y)
    turtle.left(angle)
    for i in range(4):
        turtle.forward(side)
        turtle.left(90)