from PyQt4.QtCore import * from PyQt4.QtGui import * ... self.setAttribute(Qt.WA_Maemo5PortraitOrientation, True)