Screen
The actions below reflect exactly the functions exposed by screen.py.
Note: action return values become robot state variables — use the exact return key name prefixed with $.
Only functions decorated with @decorators.robotaction are documented.
Actions
The actions below reflect exactly the functions exposed by screen.py.
Note: action return values become robot state variables — use the exact return key name prefixed with $.
Only functions decorated with @decorators.robotaction are documented.
screen.crop_screen
Capture the screen (or use the provided screen) and save/return the cropped area.
Parameters:
xywidthheightsave_pathscreen(optional)
Return:
screenshot— full captured image (numpy array).crop— cropped image (numpy array).
Exceptions:
FileNotFoundExceptionInvalidImageExtension
screen.find_image
Finds the best match for template_image and returns position and size.
Parameters:
template_imagethreshold(optional, default=0.9)screenshot_img(optional)
Return:
xywidthheight
Exceptions:
ImageNotFoundException
screen.find_image_center
Same output as find_image, but x/y are adjusted to the center of the found area.
Parameters:
same as find_image.
Return:
x,y,width,height(with centeredx/y).
screen.find_image_multiple
Finds multiple occurrences of template_image and returns indexed positions.
Parameters:
template_imagethreshold(optional, default=0.9)screenshot_img(optional)overlap_factor(optional, default=0.5)
Return:
x[0],y[0],width[0],height[0],x[1],y[1], ...length— number of occurrences found.
Exceptions:
ImageNotFoundException
screen.find_image_multiple_center
Same as find_image_multiple, but x[n]/y[n] are adjusted to the center of each occurrence.
Parameters:
same as find_image_multiple.
Return:
x[n],y[n],width[n],height[n],length.
screen.screenshot
Takes a screenshot and returns the image.
Parameters:
none
Return:
screenshot— full captured image (numpy array).
screen.wait_image
Waits until template_image appears on screen or until timeout.
Parameters:
template_imagethreshold(optional, default=0.9)screenshot_img(optional)timeout(optional, default=60)
Return:
x,y,width,height— position/size of the found image.
Exceptions:
ImageNotFoundException
screen.wait_image_disapear
Waits until template_image disappears from the screen (note function name: wait_image_disapear).
Parameters:
template_imagethreshold(optional, default=0.9)screenshot_img(optional)timeout(optional, default=60)
Return:
- none
Exceptions:
TimeoutException
screen.wait_images
Waits until any image in template_image_list appears on screen.
Parameters:
template_image_listthreshold(optional, default=0.9)screenshot_img(optional)timeout(optional, default=60)
Return:
image_found— name of the template that was located.x,y,width,height— position/size of the found image.
Exceptions:
ImageNotFoundException
Example:
screen.wait_images(["error-1.png", "error-2.png"])
if $image_found == "error-1.png":
prompt.alert("Error 1 found on screen")
elif $image_found == "error-2.png":
prompt.alert("Error 2 found on screen")