mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Only check for gnome-screenshot on Linux
Co-authored-by: Ondrej Baranovič <3819630+nulano@users.noreply.github.com>
This commit is contained in:
parent
bb18abc603
commit
3ec03c6720
|
@ -71,7 +71,11 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
|
||||||
im = im.crop(bbox)
|
im = im.crop(bbox)
|
||||||
return im
|
return im
|
||||||
except OSError:
|
except OSError:
|
||||||
if xdisplay is None and shutil.which("gnome-screenshot"):
|
if (
|
||||||
|
xdisplay is None
|
||||||
|
and sys.platform not in ("darwin", "win32")
|
||||||
|
and 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