Python if I run insade threading module label.setText("{}".format(a,b)) crashing program
(For example);
class Window(QWidget):
def __init__(self):
super().__init__()
self.setUi()
self.show()
def label(self):
self.a.setText("<a href='{}'>{}</a>".format("https://www.mertmekatronik.com","Mert Mekatronik"))
def setUi(self):
self.a = QLabel()
self.a.setText("")
q = QVBoxLayout()
q.addWidget(self.a)
self.setLayout(q)
threading.Thread(target=self.label).start()
def main():
app = QApplication(sys.argv)
window = Window()
sys.exit(app.exec())
if __name__ == "__main__":
main()
Error; Process finished with exit code -1073741819 (0xC0000005) How i solve this?
You should use QThreads for threading in Qt applications. Also you should only edit widgets from your main thread! Use signals to move results from your worker threads to your main thread.
User contributions licensed under CC BY-SA 3.0