Expression painter.width returns the width of the drawing surface expressed in pixels. The returned value is not affected by the current transformation matrix. It corresponds to the default coordinate system set by painter:initmatrix.
painter.width
painter:initmatrix