InfoBox

class vizdet.InfoBox(width, title_font=<factory>, desc_font=<factory>, title_text_color=(255, 255, 255), desc_text_color=(0, 0, 0), title_background_color=(0, 0, 0), desc_background_color=(255, 255, 255), font_height_title=15, font_height_desc=15, padding=5)

A class for drawing info boxes.

This class is meant to draw an info box, which is comprised of two parts

  • a title, which is a single line of text displayed at the top,

  • a description, which consists of multiple lines of text which are displayed below the title.

Each part has its own background, to make them visually distinct.

Parameters
  • width (int) – The width (in pixels) of the box.

  • title_font (Font) – The title font. The font file If not set, the default FiraGO font will be used for the title.

  • desc_font (Font) – The description font. The font file If not set, the default FiraGO font will be used for the description.

  • title_text_color (Tuple[int, int, int]) – The RGB color of the title text.

  • desc_text_color (Tuple[int, int, int]) – The RGB color of the description.

  • title_background – The RGB color of the title background.

  • desc_background – The RGB color of the description background.

  • font_height_title (int) – The height of the title text.

  • font_height_desc (int) – The height of the description text.

  • padding (int) – How many pixels to pad the label background on each side.

  • title_background_color (Tuple[int, int, int]) –

  • desc_background_color (Tuple[int, int, int]) –

Return type

None

draw(img, orig_coords, desc_lines, title=None)

Draw the info box.

Parameters
  • img (ndarray) – The image to draw on (will not be altered).

  • orig_coords (Tuple[int, int]) – The top-left corner of the info box.

  • desc_lines (Sequence[str]) – The lines for the description.

  • title (Optional[str]) – The text for the title. If not present, title and its background will not be drawn.