pycharmers.utils.subprocess_utils module

pycharmers.utils.subprocess_utils.run_and_capture(cmd)[source]

Run and Capture the command.

Parameters

cmd (str/list) – A string, or a sequence of program arguments.

Returns

Output.

Return type

buf (str)

Examples

>>> import os
>>> from pycharmers.utils import run_and_capture
>>> os.getcwd() == run_and_capture("pwd")
True
pycharmers.utils.subprocess_utils.get_monitor_size()[source]

Get monitor size using xrandr command. (supported only by Linux.)

Returns

width, height

Return type

size (tuple)

Examples

>>> from pycharmers.utils import get_monitor_size
>>> width, height = get_monitor_size()
>>> print(f"width  : {width}")
width  : 1920
>>> print(f"height : {height}")
height : 1958