This commit is contained in:
2024-11-29 18:15:30 +00:00
parent 40aade2d8e
commit bc9415586e
5298 changed files with 1938676 additions and 80 deletions

View File

@ -0,0 +1,30 @@
from entrypoint2 import entrypoint
import pyscreenshot
from pyscreenshot.imcodec import codec
@entrypoint
def main(filename="", bbox="", backend="", show=False):
"""Copy the contents of the screen to file.
:param filename: output file
:param show: show image
:param bbox: bounding box coordinates x1:y1:x2:y2
:param backend: back-end can be forced if set (example:scrot, wx,..),
otherwise back-end is automatic
"""
backend = backend if backend else None
if bbox:
x1, y1, x2, y2 = map(int, bbox.split(":"))
bbox = x1, y1, x2, y2
else:
bbox = None
im = pyscreenshot.grab(bbox=bbox, childprocess=False, backend=backend)
if filename:
b = codec[0](im)
with open(filename, "wb") as f:
f.write(b)
if show:
im.show()

View File

@ -0,0 +1,23 @@
import logging
from entrypoint2 import entrypoint
from pyscreenshot.loader import backend_version2
log = logging.getLogger(__name__)
@entrypoint
def main(backend):
"""Print pyscreenshot back-end version.
:param backend: back-end (example:scrot, wx,..)
"""
backend = backend if backend else None
try:
v = backend_version2(backend)
except Exception as e:
log.warning(e)
v = ""
print(v)