guibot.target module¶
SUMMARY¶
Classes and functionality related to sought targets on screen.
INTERFACE¶
- class guibot.target.Target(match_settings=None)[source]¶
Bases:
object
Target used to obtain screen location for clicking, typing, validation of expected visual output, etc.
- static from_data_file(filename)[source]¶
Read the target type from the extension of the target filename.
- Parameters:
filename (str) – data filename for the target
- Returns:
target of type determined from its data filename extension
- Return type:
target.Target
- Raises:
errors.IncompatibleTargetFileError
if the data file if of unknown type
- static from_match_file(filename)[source]¶
Read the target type and configuration from a match file with the given filename.
- Parameters:
filename (str) – match filename for the configuration
- Returns:
target of type determined from its parsed (and generated) settings
- Return type:
target.Target
- property similarity¶
Getter for readonly attribute.
- Returns:
similarity required for the image to be matched
- Return type:
float
- property center_offset¶
Getter for readonly attribute.
- Returns:
offset with respect to the target center (used for clicking)
- Return type:
location.Location
This clicking location is set in the target in order to be customizable, it is then taken when matching to produce a clicking target for a match.
- load(filename, **kwargs)[source]¶
Load target from a file.
- Parameters:
filename (str) – name for the target file
If no local file is found, we will perform search in the previously added paths.
- save(filename)[source]¶
Save target to a file.
- Parameters:
filename (str) – name for the target file
- copy()[source]¶
Perform a copy of the target data and match settings.
- Returns:
copy of the current target (with settings)
- Return type:
target.Target
- with_center_offset(xpos, ypos)[source]¶
Perform a copy of the target data with new match settings and with a newly defined center offset.
- Parameters:
xpos (int) – new offset in the x direction
ypos (int) – new offset in the y direction
- Returns:
copy of the current target with new center offset
- Return type:
target.Target
- class guibot.target.Image(image_filename=None, pil_image=None, match_settings=None, use_cache=True)[source]¶
Bases:
Target
Container for image data supporting caching, clicking target, file operations, and preprocessing.
- property filename¶
Getter for readonly attribute.
- Returns:
filename of the image
- Return type:
str
- property width¶
Getter for readonly attribute.
- Returns:
width of the image
- Return type:
int
- property height¶
Getter for readonly attribute.
- Returns:
height of the image
- Return type:
int
- property pil_image¶
Getter for readonly attribute.
- Returns:
image data of the image
- Return type:
PIL.Image
- class guibot.target.Text(value=None, text_filename=None, match_settings=None)[source]¶
Bases:
Target
Container for text data which is visually identified using OCR or general text detection methods.
- class guibot.target.Pattern(id, match_settings=None)[source]¶
Bases:
Target
Container for abstracted data which is obtained from training of a classifier in order to recognize a target.
- class guibot.target.Chain(target_name, match_settings=None)[source]¶
Bases:
Target
Container for multiple configurations representing the same target.
The simplest version of a chain is a sequence of the same match configuration steps performed on a sequence of images until one of them succeeds. Every next step in this chain is a fallback case if the previous step did not succeed.