1

I'm having a trouble with creating a sub window (which should be created within a different Python file) inside mdiArea located within my main window class.

My_app.py

from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

# importing my main app GUI
from GUIs import main_window_GUI

# importing different application modules
from Modules import login_module
from Modules.diagnostic_center_module import Diagnostic_center

class My_app(QMainWindow, main_window_GUI.Ui_main_window):
    def __init__(self):
        QMainWindow.__init__(self)
        main_window_GUI.Ui_main_window.__init__(self)
        self.setupUi(self)

        # Now I'm calling a function from *diagnostic_center_module*
        # in order to create and show a sub window within 
        # mdiArea (which is a part of Ui_main_window) called *body*
        self.show_diagnostic_center

diagnostic_center_module.py

from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

# importing my sub window GUI
from GUIs import diagnostic_center_GUI

class Diagnostic_center(object):
    def show_diagnostic_center(self):
        self.diagnostic_center_subwindow = QWidget
        self.diagnostic_center_subwindow.setObjectName("diagnostic_center_subwindow")
        self.container = QFrame(self.diagnostic_center_subwindow)

        diagnostic_GUI = diagnostic_center_GUI.Ui_diagnostic_center()
        diagnostic_GUI.setupUi(diagnostic_GUI)

        self.container.setCurrentWidget(diagnostic_GUI)

        # this part should create a sub window within mdiArea called body
        # whic is located inside My_app.py file.
        self.body.addSubWindow(self.diagnostic_center_subwindow)
        self.diagnostic_center_subwindow.showNormal()

I'm counting on your help people to help me resolve this issue. Thanks a lot in advance.

Beller0ph0n
  • 105
  • 1
  • 2
  • 10

0 Answers0