Hello Timmy,
Look at the link below:
How to take a screen shot
Personally, I use the “QQ-screenshot” version from CorttChan (醉仙灵芙).
I think this source is exactly what you are looking for.
I attached the modified file to make it compatible with python 3 and wxPython 4.2.
QQ screenshot made by wxPython (master)
QQ screenshot made by wxPython
Github
CopyScreen (updated).py (16.4 KB)
Greetings