Find the screen resolution

Introduction

The requirement: find the current screen's resolution (eg 1024x768)

The GetSystemMetrics API call is what you want. You have to look through the 7,000 possible constants to spot what you're after, but when you find them (SM_CXSCREEN and SM_CYSCREEN for width and height respectively) they turn out to be 0 and 1.

from win32api import GetSystemMetrics
width = GetSystemMetrics (0)
height = GetSystemMetrics (1)
print "Screen resolution = %dx%d" % (width, height)