Reputation: 51
This runs okay, but, when I run it, the screenshot includes also the python.exe window which pops up while running the code. I don't want the window to be in the screenshot. Any suggestions?
img = pyautogui.screenshot('Screenshot.png')
Upvotes: 0
Views: 398
Reputation: 451
sleep
before screenshot, and minimize the python window during sleep.
Upvotes: -1
Reputation: 355
you change your filename extension to .Pyw
screenshot.pyw for example
What is a PYW file?
The PYW file type is primarily associated with Python by Python Software Foundation. PYW files are used in Windows to indicate a script needs to be run using PYTHONW.EXE instead of PYTHON.EXE in order to prevent a DOS console from popping up to display the output. This patch makes it possible to import such scripts, in case they're also usable as modules.
Upvotes: 2