Tabs in different Files (as classes) with PyQt5

Viewed 648

I didn´t find a example to put the different tabs of QTabWidget in different files. Just a Methode or as a new (child-)class. I´m a beginner in Python with QT and thought I can get a better overview if I put the different tabs in different classes.

I have the following class in a MainWindow:

class pages(QTabWidget):
    def __init__(self, parent = None):
        super(pages, self).__init__(parent)
        #Variables
        self.inputFile = 0
        self.tab1 = QWidget()
        self.tab2 = page2()


        self.addTab(self.tab1,"Tab 1")
        self.addTab(self.tab2,"Tab 2")

        self.tab1UI()
        #self.tab2UI()

        self.setWindowTitle("tab demo")

(The commented tab2 I tried to get into another class which is called page2(). tab1UI ist still a method within the class pages.)

Furthermore, is it possible to Access variables in a tab in a child class to a parent one by super or something?

0 Answers
Related