def center(self): """Center the window within the current screen.""" raise NotImplementedError screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
def ajustPos(self): screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() cont = 0 while self.pos().y() + size.height() - screen.height() > -10: self.move(self.pos().x(), self.pos().y() - 5) cont += 1 if cont > 100: self.destroy() cont = 0 while self.pos().x() + size.width() - screen.width() > -10: self.move(self.pos().x() - 5, self.pos().y()) cont += 1 if cont > 100: self.destroy()
def center_on_screen(self): screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)