win32gui.GetTextExtentPoint32

cx, cy = GetTextExtentPoint32(hdc, str )

Computes the width and height of the specified string of text.

Parameters

hdc : PyHANDLE

The device context

str : string

The string to measure.