I try to run this code, but it always get this AttributeError, I have searched for many website but there wasn't any answer.
QtWidgets.QDesktopWidget().availableGeometry().center()
AttributeError: module 'PyQt6.QtWidgets' has no attribute 'QDesktopWidget'
My Code:
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def center(self):
qr = Form.frameGeometry()
cp = QtWidgets.QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
I'm using PyQt6 Version 6.1.0, Python 3.9.5