V
V
Victor Potebenko2021-03-09 19:37:27
PyQt
Victor Potebenko, 2021-03-09 19:37:27

Python shutdown when executing PyQt5 code. How to fix it?

I would be very grateful if you could help me find the error in this code snippet. I will try to answer all questions in the chat

from design import MainWindow
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QObject, QThread
import sys
import algorithm


class AlgThread(QObject):
    def __init__(self, font_name, lang, save_path, open_):
        super(AlgThread, self).__init__()
        self.font_name = font_name
        self.lang = lang
        self.save_path = save_path
        self.open_ = open_

    def run(self):
        algorithm.make_prescription(self.font_name, self.lang, self.save_path, self.open_)


def saving(font_name, lang, save_path, open_):
    thread = QThread()
    alg = AlgThread(font_name, lang, save_path, open_)
    alg.moveToThread(thread)
    thread.started.connect(alg.run)
    thread.start()


app = QApplication(sys.argv)
window = MainWindow()
window.saving_sgl.connect(saving)
window.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 question

Ask a Question

731 491 924 answers to any question