Closed MaxGorr closed 1 year ago
Very Interesting! I tried your sample code on my windows machine and what you are saying is indeed true. But the thing is... it's related to the working of command prompt and powershell. This has absolutely nothing to do with pyautogui. This is happening because when you click on command prompt it will enter selection state, when it is in the selection state it will not run your code. I'm not exactly sure why this happens, but I'm sure about one thing, that is... this has something do with command prompt itself not with python or pyautogui. when you click on some other key, it will return from selection state and then it will continue. Try running any code and this will happen. while the below example code is running click inside the command prompt window manually.
import time
time.sleep(10)
while True:
print('Before')
time.sleep(5) # Here Manually click on the command prompt
print('After')
time.sleep(10)
Hope it helps!
Thanks a lot! It is indeed a shell's "feature", and not about PyAutoGUI
Thanks a lot! It is indeed a shell's "feature", and not about PyAutoGUI
You're welcome! :) 👍
Environment
Description
Let's consider a simple clicker:
Run cmd.exe, a point (100, 100) should be inside a cmd.exe window. Run this script (e.g.
python clicker.py
).Actual behavior:
Expected behavior:
Details