GUI

A class responsible for rendering the user interface.

Interface

class src.data_acquisition.gui.Gui[source]

Bases: ABC

abstractmethod draw_image(image_path: Path) None[source]
abstractmethod draw_rectangle(*, color: Color, top_left_point: Point, width: int, height: int) None[source]
abstractmethod draw_text(*, font_size: int, text: str, color: Color) None[source]
abstractmethod draw_uniform_background(color: Color) None[source]
abstractmethod get_window_size() ElementSize[source]
abstractmethod on_init(callback: Callable[[], None]) None[source]

Used to register a callback function that will be called when the GUI is ready.

abstractmethod play_sound(sound_path: Path) None[source]
abstractmethod start() None[source]
abstractmethod stop() None[source]
abstractmethod subscribe_to_event_and_get_id(*, event: EventType, callback: Callable[[], None]) int[source]
Returns:

An event ID that can be used to unsubscribe from the event later.

abstractmethod unsubscribe_from_event_by_id(event_id: int) None[source]
Param:

event_id: The ID of the event to unsubscribe from, returned by the subscribe method.

How to subclass

Subclasses should implement the following methods:

  • draw_image(image_path: Path)

  • draw_rectangle(*, color: Color, top_left_point: Point, width: int, height: int)

  • draw_text(*, font_size: int, text: str, color: Color)

  • draw_uniform_background(color: Color)

  • get_window_size()  -> ElementSize

  • on_init(callback: Callable[[], None])

  • play_sound(sound_path: Path)

  • start()

  • stop()

  • subscribe_to_event_and_get_id(*, event: EventType, callback: Callable[[], None]) -> int

  • unsubscribe_from_event_by_id(event_id: int)

Catalog