Answer the question
In order to leave comments, you need to log in
How to add window to mdiArea d PyQt5?
Hello.
Knowing please tell me how to add windows to mdiArea.
Here I sketched a very simple example, but it does not work for me. I roughly understand why it doesn't work but I don't know how to fix it.
QtDesiner
Code
import sys
from PyQt5.QtWidgets import *
from PyQt5 import QtGui, QtCore
from PyQt5.uic import loadUiType
app = QApplication(sys.argv)
main_class, base_class = loadUiType('main.ui')
dialog_1_class, dialog_1_base_class = loadUiType("dialog.ui")
class MainWindow(QMainWindow, main_class):
def __init__(self, *args):
super(MainWindow, self).__init__(*args)
self.setupUi(self)
dialog1 = Dialog
self.mdiArea.addSubWindow(dialog1)
class Dialog(QWidget, dialog_1_class):
def __init__(self, *args):
super(Dialog, self).__init__(*args)
self.setupUi(self)
main = MainWindow()
main.show()
sys.exit(app.exec_())
Answer the question
In order to leave comments, you need to log in
I found how to fix everything.
It is necessary to put brackets
How did I get so fucked up!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question