Screen API

Functions for screen information and capture.


screen_size

screen_size()

Returns the current screen resolution.

Returns:

Screen dimensions as (width, height).

Return type:

tuple[int, int]


screenshot

screenshot(file_path=None, screen_region=None)

Captures the current screen image.

Parameters:
  • file_path (str) – File path to save the screenshot. If None, the image is not saved.

  • screen_region (list) – Region to capture as [x1, y1, x2, y2]. If None, captures the full screen.

Returns:

The captured screen image.

Return type:

list[int]