The code to center a window in pyside is as follows:
center = QScreen.availableGeometry(QApplication.primaryScreen()).center()
geo = mainwindow.frameGeometry()
geo.moveCenter(center)
mainwindow.move(geo.topLeft())
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QMainWindow
from PySide6.QtGui import QScreen
app = QApplication(sys.argv)
mainwindow = QMainWindow()
mainwindow.setGeometry(0, 0, 800, 600)
mainwindow.show()
center = QScreen.availableGeometry(QApplication.primaryScreen()).center()
geo = mainwindow.frameGeometry()
geo.moveCenter(center)
mainwindow.move(geo.topLeft())
app.exec_()
And here is the result: