get screen resolution
You need the current screen resolution.
Solution #1 (command-line)
xrandr | grep '*'
1920x1080 50.0* 51.0 52.0
This tip is from here.
Solution #2 (Python)
Let’s see the previous solution in Python:
from jabbapylib.process import process def get_screen_resolution(): """ Screen resolution (as a tuple). """ result = [x for x in process.get_simple_cmd_output('xrandr').split('\n') if '*' in x] result = tuple([int(x) for x in result.split().split('x')]) return result
process.get_simple_cmd_output is part of my jabbapylib library.
get_simple_cmd_output() simply executes an external command and returns its output as a string.