def draw_triangle(t):
    """Draws a triangle t = (v0, v1, v2)"""
    def func(ctx):
        v0, v1, v2 = t
        ctx.move_to(v0.x, v0.y)
        ctx.line_to(v1.x, v1.y)
        ctx.line_to(v2.x, v2.y)
        ctx.close_path()
    return func