I’ve tried the following methods but none would work on Linux
from win32.win32api import GetSystemMetrics print(GetSystemMetrics(0), GetSystemMetrics(1))
from ctypes import windll info = windll.user32 print(info.GetSystemMetrics(0), info.GetSystemMetrics(1))
Advertisement
Answer
Try using tkinter
, like:
from tkinter import * root = Tk() root.withdraw() height,width = root.winfo_screenheight(),root.winfo_screenwidth() print(height,width)