Color Key APIΒΆ
The constructor takes a list of codes as strings and creates a
ColorKey
object. Each code is assigned a color. The codes are
used to extract colors from the key.
def get_color(self, code):
'''
Given a code, return the corresponding color.
If the code is not in set of known codes,
then return the default color (gray).
Inputs:
tag: string
Returns: color
'''
def draw_color_key(self, canvas, x0, y0, x1, y1, code_to_label=None):
'''
Draw the color key in the specified rectangle ((x0, y0), (x1, y1)).
Inputs:
canvas: ChiCanvas object
x0, y0, x1, y1: floats with coordinates for points (x0, y0)
and (x1, y1)
code_to_label: (optional) maps codes to strings that will
be used to identify the colors.
'''