GetText

class GetText(left_top_point: Point | RelativelyPoint = <apparser.geometry.relatively_point.RelativelyPoint object>, right_bottom_point: Point | RelativelyPoint = <apparser.geometry.relatively_point.RelativelyPoint object>, reload_every_try: bool = True)[source]

Bases: OCRInstruction

Read text from a selected screen region.

property id: int

Return the unique OCR instruction identifier.

Returns:

OCR instruction identifier.

Return type:

int

perform(ui: BaseUi, text_reader: BaseTextReader, *args, **kwargs)[source]

Execute the instruction with a text reader.

Parameters:
  • ui (BaseUi) – UI instance used during execution.

  • text_reader (BaseTextReader) – Text reader used to detect text.

  • args – Additional positional arguments for the execution flow.

  • kwargs – Additional keyword arguments for the execution flow.

Returns:

Updated UI state when the implementation returns it.

Return type:

BaseUi

property local_answer: list[TextData]

Return the texts coordinates in local Ui object of the last perform.

Returns:

Texts coordinates in local Ui object.

Return type:

list[TextData]

property global_answer: list[TextData]

Return the global texts coordinates of the last perform.

Returns:

Global texts coordinates.

Return type:

list[TextData]

property screenshot: ndarray

Return the screenshot of the last perform.

Returns:

Ui screenshot

Return type:

numpy.ndarray