Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with mouse clicks when using virtual screen #886

Open
amirabbasja opened this issue Oct 10, 2024 · 0 comments
Open

Issue with mouse clicks when using virtual screen #886

amirabbasja opened this issue Oct 10, 2024 · 0 comments

Comments

@amirabbasja
Copy link

I need a repetitive task done on a virtual ubuntu 22.04 machine. I used pyautogui for it; to connect the screen to pyautogui, I used xvfb with following codes:

Xvfb :99 -screen 0 1024x768x16 &
export DISPLAY=:99

I am able to see the screen, and take screenshots using pyautogui, however, the clicking/dragging function doesn't work. Please note that I am connecting to the vitrtual environment using XRDP and have installed light weight ubuntu-desktop. The code is as follows:

import os
from IPython.display import Image

os.environ['DISPLAY'] = ':99'
import pyautogui
screenWidth, screenHeight = pyautogui.size() # Get the size of the primary monitor.
print(screenWidth, screenHeight)

pyautogui.click(200,200)

There is a button on coordinates (200,200), however, it never gets invoked. What can I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant