Y
Y
yong2019-04-17 11:50:28
Python
yong, 2019-04-17 11:50:28

How to write to a variable the information entered in QTextEdit on pressing QPushButton? Located on QDockWidget?

It is necessary that when the button is pressed, the data is written to the variable, but when pressed, the program closes with the error Process finished with exit code -1073740791 (0xC0000409)
Here is a part of the code:

class MainWindow(QMainWindow):
    def __init__(self, *args, **kwargs):
******
******
        self.docked = QDockWidget("Программа!", self)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.docked)
        self.dockedWidget = QWidget(self)
        self.docked.setWidget(self.dockedWidget)
        self.dockedWidget.setLayout(QVBoxLayout())
        textzz = QLabel()
        textzz.setText('Тут будет текст')
        self.dockedWidget.layout().addWidget(textzz)
        formazhalob = QTextEdit()
        formazhalob.setText('Что то не работает? Напиши!')
        formazhalob.setFixedSize(190,100)
        self.dockedWidget.layout().addWidget(formazhalob)
        button_otpravka = QPushButton(('Отправить информацию'))
        button_otpravka.clicked.connect(self.insertAll)
        self.dockedWidget.layout().addWidget(button_otpravka)
    def insertAll(self):
        text_zhaloba = self.formazhalob.toPlainText()
        self.textzz.setText(text_zhaloba)

app = QApplication(sys.argv)

window = MainWindow()

app.exec_()

Tell me why the program crashes. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Lazarev, 2019-04-17
@yong

I'm not sure what exactly is the matter, but at least insertAll()it should be decorated as @Slot()or@pyqtSlot().

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question