What's new

Help Pyautogui mouse click notworking when monitor is turnedoff

trumpoikot

Addict
Joined
Nov 16, 2021
Posts
110
Reaction
65
Points
81
pyautogui mouse click notworking when monitor is turnedoff

please help, new lang po kasi ako sa python maraming salamat po.
 
Hello! I'm sorry to hear that you're experiencing an issue with pyautogui mouse clicks not working when your monitor is turned off. This can happen because pyautogui needs a visible screen to perform mouse clicks.

One potential solution to this problem would be to use a virtual display manager like Xvfb. Xvfb allows you to run GUI applications on a headless server, so you can run your script without a physical display attached.

To use Xvfb with your Python script, you'll need to install the package and start a virtual display session using the following code:

Code:
sudo apt-get install xvfb
Xvfb :99 -screen 0 1024x768x24 &
export DISPLAY=:99

This will create a virtual display with a resolution of 1024x768 and 24-bit color depth. You can then run your Python script as usual, and it should be able to perform mouse clicks even when your physical display is turned off.

I hope this helps! Let me know if you have any other questions.
 

Similar threads

Back
Top