view pyntnclick/tools/utils.py @ 690:4a933444c99b pyntnclick

The return of the rects to the rect drawer
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 14 Feb 2012 12:24:33 +0200
parents ebc48b397fd5
children 60bf20849231
line wrap: on
line source

# Misc utils I don't know where else to put


def list_scenes(get_initial_state):
    """List the scenes in the state"""
    state = get_initial_state()
    print 'Available scenes are : '
    for scene in state.scenes:
        print '    ', scene
    print 'Available details are : '
    for detail in state.detail_views:
        print '    ', detail

def draw_rect_image(surface, color, rect, thickness):
    """Draw a rectangle with lines thickness wide"""
    # top
    surface.fill(color, (rect.left, rect.top, rect.width, thickness))
    # bottom
    surface.fill(color, (rect.left, rect.bottom - thickness, rect.width,
        thickness))
    # left
    surface.fill(color, (rect.left, rect.top, thickness, rect.height))
    # right
    surface.fill(color, (rect.right - thickness, rect.top, thickness,
        rect.height))