def rotating_cube(degree_change=3, frame_rate=3):
    """Rotating cube program

    How it works:

      1. Create two imaginary ellipses
      2. Sized to fit in the top third and bottom third of screen
      3. Create four imaginary points on each ellipse
      4. Make those points the top and bottom corners of your cube
      5. Connect the lines and render
      6. Rotate the points on the ellipses and repeat

    """
    degrees = 0
    while True:
        t1 = time.time()

        with Frame() as frame:
            oval_width = frame.width
            oval_height = frame.height / 3.0
            cube_height = int(oval_height * 2)

            (p1_x, p1_y) = ellipse_point(degrees, oval_width, oval_height)
            (p2_x, p2_y) = ellipse_point(degrees + 90, oval_width, oval_height)
            (p3_x, p3_y) = ellipse_point(degrees + 180, oval_width, oval_height)
            (p4_x, p4_y) = ellipse_point(degrees + 270, oval_width, oval_height)
            degrees = (degrees + degree_change) % 360

            # connect square thing at top
            frame.line(p1_x, p1_y, p2_x, p2_y)
            frame.line(p2_x, p2_y, p3_x, p3_y)
            frame.line(p3_x, p3_y, p4_x, p4_y)
            frame.line(p4_x, p4_y, p1_x, p1_y)

            # connect top to bottom
            frame.line(p1_x, p1_y, p1_x, p1_y + cube_height)
            frame.line(p2_x, p2_y, p2_x, p2_y + cube_height)
            frame.line(p3_x, p3_y, p3_x, p3_y + cube_height)
            frame.line(p4_x, p4_y, p4_x, p4_y + cube_height)

            # connect square thing at bottom
            frame.line(p1_x, p1_y + cube_height, p2_x, p2_y + cube_height)
            frame.line(p2_x, p2_y + cube_height, p3_x, p3_y + cube_height)
            frame.line(p3_x, p3_y + cube_height, p4_x, p4_y + cube_height)
            frame.line(p4_x, p4_y + cube_height, p1_x, p1_y + cube_height)

        elapsed = (time.time() - t1)
        time.sleep(abs(1.0 / frame_rate - elapsed))
Rotating cube program

    How it works:

      1. Create two imaginary ellipses
      2. Sized to fit in the top third and bottom third of screen
      3. Create four imaginary points on each ellipse
      4. Make those points the top and bottom corners of your cube
      5. Connect the lines and render
      6. Rotate the points on the ellipses and repeat