Answer the question
In order to leave comments, you need to log in
PyQt5 another class function not working, why?
Help me please. There is a code and a form. The form has an empty QWidget (wid). It is necessary to fill wid from another class, so that all functions work,
here is the code:
import os
import sys
from PyQt5.QtWidgets import *
from PyQt5.uic import loadUi
class Start(QMainWindow):
def __init__(self):
#super(Start, self).__init__()
QMainWindow.__init__(self)
loadUi("untitled.ui", self)
Down(self.wid)
class Down(QWidget):
def __init__(self, wid):
super(Down, self).__init__()
self.line = QLineEdit(self)
self.line.setPlaceholderText("TEXT")
btn = QPushButton('Click')
vbox = QVBoxLayout(wid)
vbox.addWidget(self.line)
vbox.addWidget(btn)
btn.clicked.connect(self.PreDownload)
def PreDownload(self):
print("click")
if __name__ == '__main__':
app = QApplication(sys.argv)
mainWindow = Start()
mainWindow.show()
sys.exit(app.exec_())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question