import ctypes def get_refresh_rate(): hDC = ctypes.windll.user32.GetDC(0) refresh_rate = ctypes.windll.gdi32.GetDeviceCaps(hDC, 112) return refresh_rate print(“Refresh rate:”, get_refresh_rate(), “Hz”)