Display¶
Using the methods below you will be able to interact with the display.
Getting display size¶
Using the display size method, you can get the screen dimension (width and height) in pixels.
Getting screenshot¶
With the get screenshot method, it is possible to take a screenshot and save it in any directory passing the path as a parameter.
# Take a screenshot, save the file path given and return the screenshot Image object.
bot.get_screenshot(filepath='my_screenshot_with_method_get_screenshot.png')
Tip
The method takes an optional parameter region which is a tuple with values of left, top, width and height to cut part of the screen.
Learn more at the full API documentation.
Getting partial screenshot¶
As we saw above, it is possible to take a screenshot of the entire screen.
Using the screen cut method and passing as parameters the x and y coordinates along with the width and height,
only the indicated area will be collected.
Saving a screenshot¶
The save screenshot has pretty much the same functionality as the get_screenshot and screenshot methods.
The only difference is that it does not return an Image object but instead, it simply saves the image on disk.