Devices Module

Classes:

XACamera()

A reusable controller for camera-related functionality.

XAMicrophone()

A reusable controller for microphone-related functionality.

XAScreen()

A reusable controller for screen-related functionality.

class PyXA.Additions.Devices.XACamera[source]

Bases: object

A reusable controller for camera-related functionality.

New in version 0.3.0.

Methods:

capture()

record(file_path[, duration])

Records a video for the specified duration, saving into the provided file path.

capture() XAImage[source]
record(file_path: str | XAPath, duration: float | None = 10) XAVideo[source]

Records a video for the specified duration, saving into the provided file path.

Parameters:
  • file_path (Union[str, XAPath]) – The file path to save the video at.

  • duration (Union[float, None], optional) – The duration of the video, in seconds, or None to record continuously until the script is canceled, defaults to 10.

Returns:

The resulting video as a PyXA object.

Return type:

XAVideo

New in version 0.3.0.

class PyXA.Additions.Devices.XAMicrophone[source]

Bases: object

A reusable controller for microphone-related functionality.

New in version 0.3.0.

Methods:

record(file_path[, duration])

Records audio for the specified duration, saving into the provided file path.

record(file_path: str | XAPath, duration: float | None = 10) XASound[source]

Records audio for the specified duration, saving into the provided file path.

Parameters:
  • file_path (Union[str, XAPath]) – The file path to save the audio at.

  • duration (Union[float, None], optional) – The duration of the audio, in seconds, or None to record continuously until the script is canceled, defaults to 10.

Returns:

The resulting audio as a PyXA object.

Return type:

XASound

New in version 0.3.0.

class PyXA.Additions.Devices.XAScreen[source]

Bases: object

A reusable controller for screen-related functionality.

New in version 0.3.0.

Methods:

capture()

Captures the screen and returns it as a PyXA.XABase.XAImage object.

capture_rect(x, y, width, height)

Captures the screen within the specified rectangle and returns it as a PyXA.XABase.XAImage object.

capture_window(app, window_index)

Captures the specified window and returns it as a PyXA.XABase.XAImage object.

record(file_path[, duration])

capture() XAImage[source]

Captures the screen and returns it as a PyXA.XABase.XAImage object.

Returns:

The resulting image.

Return type:

XAImage

New in version 0.3.0.

capture_rect(x: int, y: int, width: int, height: int) XAImage[source]

Captures the screen within the specified rectangle and returns it as a PyXA.XABase.XAImage object.

Parameters:

rect (XARect) – The rectangle to capture.

Returns:

The resulting image.

Return type:

XAImage

New in version 0.3.0.

capture_window(app: XAApplication, window_index: int) XAImage[source]

Captures the specified window and returns it as a PyXA.XABase.XAImage object.

Parameters:
  • app (XAApplication) – The application to capture the window from.

  • window_index (int) – The index of the window to capture.

Returns:

The resulting image.

Return type:

XAImage

New in version 0.3.0.

record(file_path: str | XAPath, duration: float | None = 10) XAVideo[source]