qrunnable

Python crashes when running a log streamer using Qt

百般思念 提交于 2021-02-05 06:23:04
问题 Goal I have a process that logs on a file (realtime.log) while running and I want to print every new line of that file in my application in realtime. In other words I want to redirect the output from the process to the GUI. This means that I have two different processes running: the "engine" and the GUI. I have already achieved this by using Tkinter but since I have to make a more complex, professional and good looking GUI I decided to switch to Qt for Python ( PySide2 ). Problem Python often

How to kill the QRunnable in PyQt5?

与世无争的帅哥 提交于 2021-02-04 21:05:36
问题 I have an app with two buttons start and end . The start button will start a thread, which runs the audio recording function. This function is written using sounddevice and soundfile libraries. The audio recording can take place for an arbitary duration and the user can stop anytime by pressing ctrl+c . So, now I want to implement a function for the end button to stop the thread which started by pressing start button or the function can send ctrl+c signal to the thread. So, that the current

Connect QRunnable to a function/method when finished

前提是你 提交于 2020-02-04 04:51:17
问题 QThread has a finished signal, and I am able to do something when thread is finished (connect to a method/function), however I would like to do this with QRunnable as well. Is there a way to connect the QRunnable thread to a method/function when it is done? QThread: class HelloWorldTask(QThread): def __init__(self): QThread.__init__(self) def run(self): import time time.sleep(3) print ("Running thread \n") time.sleep(3) hello.finished.connect(check) def check(): print('Thread Done') output: