autopilot.display.Display

class autopilot.display.Display

The base class/inteface for the display devices.

static create(preferred_backend='')

Get an instance of the Display class.

For more infomration on picking specific backends, see Advanced Backend Picking

Parameters:preferred_backend

A string containing a hint as to which backend you would like.

possible backends are:

  • X11 - Get display information from X11.
  • UPA - Get display information from the ubuntu platform API.
Raises:RuntimeError if autopilot cannot instantate any of the possible backends.
Raises:RuntimeError if the preferred_backend is specified and is not one of the possible backends for this device class.
Raises:BackendException if the preferred_backend is set, but that backend could not be instantiated.
Returns:Instance of Display with appropriate backend.
exception BlacklistedDriverError

Cannot set primary monitor when running drivers listed in the driver blacklist.

Display.get_num_screens()

Get the number of screens attached to the PC.

Display.get_primary_screen()
Display.get_screen_width(screen_number=0)
Display.get_screen_height(screen_number=0)
Display.get_screen_geometry(monitor_number)

Get the geometry for a particular monitor.

Returns:Tuple containing (x, y, width, height).
autopilot.display.get_screenshot_data(display_type)

Return a BytesIO object of the png data for the screenshot image.

display_type is the display server type. supported values are:
  • “X11”
  • “MIR”
Raises:
  • RuntimeError – If attempting to capture an image on an unsupported display server.
  • RuntimeError – If saving image data to file-object fails.