python get screen size
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
4.2
5
from win32api import GetSystemMetrics
print("Width =", GetSystemMetrics(0))
print("Height =", GetSystemMetrics(1))
Thank you!
5
0
4.4
10
from os import get_terminal_size
size = get_terminal_size() # Columns, Lines
Thank you!
10
0
0
0
from screeninfo import get_monitors
screen = get_monitors()[0]
# if that raises an error, put this first
# from os import environ
# environ['DISPLAY'] = ':0.0'
print(screen)
Thank you!
0
0
Are there any code examples left?
New code examples in category Python