guibot.match module

class guibot.match.Match(xpos, ypos, width, height, dx=0, dy=0, similarity=0.0, dc=None, cv=None)[source]

Bases: guibot.region.Region

Wrapper around image which adds data necessary for manipulation of matches on a screen.

__init__(xpos, ypos, width, height, dx=0, dy=0, similarity=0.0, dc=None, cv=None)[source]

Build a match object.

Parameters:
  • xpos (int) – x coordinate of the upleft vertex of the match region
  • ypos (int) – y coordinate of the upleft vertex of the match region
  • width (int) – x distance from upleft to downright vertex of the match region
  • height (int) – y distance from upleft to downright vertex of the match region
  • dx (int) – x offset from the center of the match region
  • dy (int) – y offset from the center of the match region
  • similarity (float) – attained similarity of the match region
__str__()[source]

Provide the target location of the match distinguishing it from any location.

x

Getter for readonly attribute.

Returns:x coordinate of the upleft vertex of the region
Return type:int
y

Getter for readonly attribute.

Returns:y coordinate of the upleft vertex of the region
Return type:int
dx

Getter for readonly attribute.

Returns:x offset from the center of the match region
Return type:int
dy

Getter for readonly attribute.

Returns:y offset from the center of the match region
Return type:int
similarity

Getter for readonly attribute.

Returns:similarity the match was obtained with
Return type:float
target

Getter for readonly attribute.

Returns:target location to click on if clicking on the match
Return type:location.Location
calc_click_point(xpos, ypos, width, height, offset)[source]

Calculate target location to click on if clicking on the match.

Parameters:
  • xpos (int) – x coordinate of upleft vertex of the match region
  • ypos (int) – y coordinate of upleft vertex of the match region
  • width (int) – width of the match region
  • height (int) – height of the match region
  • offset (location.Location) – offset from the match region center for the final target
Returns:

target location to click on if clicking on the match

Return type:

location.Location