qinputdialog

How to center QMessageBox and QInputDialog on the screen?

假如想象 提交于 2020-01-30 06:50:21
问题 I have this function to center an object in the middle of the screen. I want to center a QMainWindow, QInputDialog and a QMessageBox. This is my MessageBox: def _Warning(self,_type): infoBox = QtWidgets.QMessageBox() infoBox.setIcon(QtWidgets.QMessageBox.Warning) infoBox.setWindowTitle("Warning") if (_type=="File"): infoBox.setText("The File Already exist in the current Directory") else: infoBox.setText("The Folder Already exist in the current Directory") self.center(infoBox) infoBox.exec_()