It finds digits on screenshot (or screen) using images of digits (Monospace Regular 12).
And then it groups digits by "y" coordinate and later group by "x" coordinate to (re)create numbers.
Example screenshot for test:
Doc: PyAutoGUI - Screenshot Functions
Tested on Linux Mint.
It needs to install:
apt-get install scrot # to grab screenshot
pip install pyautogui