1

I don't understand why by default a QDialog is placed in center position and a QMainWindow in the top left corner?

Example code:

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog


class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("MainWindow")


class Dialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Dialog")


if __name__ == "__main__":
    app = QApplication(sys.argv)
    main_window = MainWindow()
    main_window.show()
    dialog = Dialog()
    dialog.show()
    sys.exit(app.exec_())

I would prefer a QMainWindow in center position by default.

Atalanttore
  • 349
  • 5
  • 22
  • Possible duplicate of [Show QMainwindow in the middle of the screen](https://stackoverflow.com/questions/5710824/show-qmainwindow-in-the-middle-of-the-screen) – ekhumoro Feb 03 '19 at 20:19
  • Possible duplicate of [PyQt center window on active screen](https://stackoverflow.com/q/20243637/984421) – ekhumoro Feb 03 '19 at 20:20

0 Answers0