This code works, but I wonder if there is any simpler way:
def center(self):
qr = self.frameGeometry()
cp = gui.QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
This code works, but I wonder if there is any simpler way:
def center(self):
qr = self.frameGeometry()
cp = gui.QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
No, it's the simplest way. Here is a snippet I've used in C++:
Just another "func-style" example. If you use it several times.
And every time in code:
just add this line to your main windows :