예제 #1
0
def draw_a_spiral():
    t = turtle.Turtle()

    t.shape("classic")
    t.color("red")
    t.penup()
    t.setx(150)
    t.sety(-150)
    number_of_sides = int(raw_input("How many sides will your shape have? "))
    interior_angles = 180 + ((number_of_sides - 3) * 180)
    ea_angle = interior_angles / number_of_sides
    angle = 180 - ea_angle
    length = (int(
        raw_input("How many inches do you want the side of your shape? "))
              ) * 50
    spiral(t, number_of_sides, angle, length)

    saveImg()

    t.clear()
예제 #2
0
def slanted_pot_function():
    t = turtle.Turtle()

    t.shape("classic")
    t.color("red")
    t.penup()

    number_of_lobes = int(raw_input("How many sides will your pot have? "))
    angle_1 = (360 / number_of_lobes)
    angle_2 = 180 - angle_1
    side = (int(raw_input("How inches tall will each lobe be? "))) * 50
    top = (int(raw_input("How inches wide will each lobe be? "))) * 50

    setup_template(t, angle_2)

    for i in range(0, number_of_lobes):
        draw_lobe(t, angle_1, angle_2, side, top)
        t.left(angle_2)

    saveImg()

    t.clear()
예제 #3
0
def outward_pot_template():
    t = turtle.Turtle()

    t.shape("classic")
    t.color("red")
    t.penup()
    t.setx(-150)
    t.sety(150)
    # pot must have more than 5 lobes and be wider than it is tall...
    number_of_lobes = int(raw_input("How many sides will your pot have? "))
    # this factor makes the template vertical vs. slanted
    angle = (360 / number_of_lobes)
    side = (int(raw_input("How inches tall will each lobe be? "))) * 50
    top = side + 50

    setup_template(t, angle)

    for i in range(0, number_of_lobes):
        draw_lobe(t, angle, side, top)
        t.left(angle + 90)

    saveImg()

    t.clear()