mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Prefer gnome-screenshot if xdisplay is None
Co-authored-by: Ondrej Baranovič <nulano@nulano.eu>
This commit is contained in:
parent
a48d95061d
commit
b1ba0909ed
|
@ -61,7 +61,7 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
|
||||||
left, top, right, bottom = bbox
|
left, top, right, bottom = bbox
|
||||||
im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
|
im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
|
||||||
return im
|
return im
|
||||||
elif not Image.core.HAVE_XCB and shutil.which("gnome-screenshot"):
|
elif shutil.which("gnome-screenshot"):
|
||||||
fh, filepath = tempfile.mkstemp(".png")
|
fh, filepath = tempfile.mkstemp(".png")
|
||||||
os.close(fh)
|
os.close(fh)
|
||||||
subprocess.call(["gnome-screenshot", "-f", filepath])
|
subprocess.call(["gnome-screenshot", "-f", filepath])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user