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

gui.py cannot capture screen in the second monitor #57

Closed
JulianNotFound opened this issue Dec 3, 2021 · 4 comments
Closed

gui.py cannot capture screen in the second monitor #57

JulianNotFound opened this issue Dec 3, 2021 · 4 comments

Comments

@JulianNotFound
Copy link

Hi, thank you for the excellent work. I meet some problems when using the gui. I am using Ubuntu20.04 with a kde desktop. After running the screen snip(button or alt+s), I can only start the area selection in the main monitor and the opacity only changes in the main monitor. If I press my mouse in the main screen and drag it to the second screen, the program can accurately select the area but the selected rectangle only shows the main screen part. I can not select area if I firstly press my mouse in the second screen.
When using the "gui.py" script, I slightly modify it and I'm quite sure that these changes are not related with this problem. Anyway, here are the changes that I made. The ImageGrab from PIL keep throwing errors so I change from PIL import ImageGrab to import pyscreenshot as ImageGrab. I also remove the all_screen parameter in line 252: img = ImageGrab.grab(bbox=(x1, y1, x2, y2), all_screens=True) since this parameter is only available in Windows.

@lukas-blecher
Copy link
Owner

Hi, thanks for opening the issue.
You are right, PIL does not support multiple monitors in linux. Did pyscreenshot end up working? Are you able to grab all monitors with the library?

If not, can you please follow these steps:

  1. Install mss: pip install ms
  2. run the following script
import mss
with mss.mss() as sct:
    sct.shot(mon=-1, output='fullscreen.png')
  1. It should generate a file fullscreen.png in your current working directory. Can you tell me if all your screens are visible in the picture?

If so I might be able to rewrite the screen grabbing code.

@JulianNotFound
Copy link
Author

JulianNotFound commented Dec 4, 2021

Thanks for your reply. Both pyscreenshot and mss can get grab all monitors.
I guess the problem is related to the QT application instead of the screen grabbing part. It seems that the QT application only control the main screen output. Besides, issue #40 may be related to the same problem.

@lukas-blecher
Copy link
Owner

Ok thank you, I think I understand now what you mean.
It won't be easy for me to debug because my Linux doesn't like additional monitors.
I will see when I'll get around to fixing it.
Of course I'd be happy for some help if you are interested :)

@lukas-blecher
Copy link
Owner

should be fixed now with gnome-screenshot and flag --gnome thanks to #111

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

No branches or pull requests

2 participants