added method to get user selection rectangle

This commit is contained in:
kageru 2018-04-13 20:36:24 +02:00
parent e5b10a6b73
commit 50e49edcb4
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -67,6 +67,19 @@ def take_screenshot(edit=False) -> None:
os.remove(file)
def get_user_selection() -> namedtuple:
raw_coords = check_output(['slop', '-f', '%x,%y,%w,%h']).decode()
x, y, w, h = [int(x) for x in raw_coords.split(',')]
Point = namedtuple('Point', ['x', 'y'])
Rectangle = namedtuple('Rectangle', ['p1', 'p2'])
top_left = Point(x, y)
bottom_right = Point(x+w, y+h)
return Rectangle(top_left, bottom_right)
def record_screen() -> None:
pass
def get_extension(filename: str) -> str:
"""
Returns the extension of a file/full path as a string.