Exemple #1
0
 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)
Exemple #2
0
    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()
Exemple #3
0
    def center_on_screen(self):

        screen = QtGui.QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)