The function window_viewport_transform

geom.window_viewport_transform(window, width, height)

Returns a tuple (sx, sy, tx, ty) that represents the geometric transform needed to transform points of the window into pixels of a viewport of the given width and geight.

Parameters:
  • window (Box) – window

  • width (int) – width of the viewport

  • height (int) – height of the viewport

Returns:

the tuple (sx, sy, tx, ty)

You can download the module geom.py.