anki_vector.camera_viewer

This module provides the camera viewer’s render process.

It should be launched in a separate process to allow Vector to run freely while the viewer is rendering.

It uses Tkinter, a standard Python GUI package. It also depends on the Pillow library for image processing.

Functions

main(queue, event[, overlays, timeout, …])

Rendering the frames in another process.

Classes

TkCameraViewer(queue, event[, overlays, …])

A Tkinter based camera video feed.

class anki_vector.camera_viewer.TkCameraViewer(queue, event, overlays=None, timeout=10.0, force_on_top=True)

A Tkinter based camera video feed.

Parameters
  • queue (Queue) – A queue to send frames between the user’s main thread and the viewer process.

  • event (Event) – An event to signal that the viewer process has closed.

  • overlays (Optional[list]) – Overlays to be drawn on the images of the renderer.

  • timeout (float) – The time without a new frame before the process will exit.

  • force_on_top (bool) – Specifies whether the window should be forced on top of all others.

draw_frame()

Display an image on to a Tkinter label widget.

Return type

None

anki_vector.camera_viewer.main(queue, event, overlays=None, timeout=10.0, force_on_top=False)

Rendering the frames in another process. This allows the UI to have the main thread of its process while the user code continues to execute.

Parameters
  • queue (Queue) – A queue to send frames between the user’s main thread and the viewer process.

  • event (Event) – An event to signal that the viewer process has closed.

  • overlays (Optional[list]) – Overlays to be drawn on the images of the renderer.

  • timeout (float) – The time without a new frame before the process will exit.

  • force_on_top (bool) – Specifies whether the window should be forced on top of all others.

Return type

None