Questions tagged [qrunnable]

20 questions
4
votes
1 answer

Connect QRunnable to a function/method when finished

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…
Drees
  • 688
  • 1
  • 6
  • 21
3
votes
2 answers

Python crashes when running a log streamer using Qt

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…
John Reds
  • 117
  • 14
2
votes
0 answers

STOP/Emit signal TO QRunnable

So i have a loop inside a qrunable object and i want to stop it from the main thread when clicking on a button. i think i understand the flow : i need a var that i cant pass from main to the qrunable object (thread) and check it as the condition for…
Udi
  • 67
  • 8
2
votes
1 answer

How to kill the QRunnable in PyQt5?

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…
user8026974
1
vote
0 answers

QThreadPool doesn't release memory after QRunnable has ended

I'm trying to implement image thumbnail loading. I use QThreadPool to make it multicore, but when an image loads, it doesn't free memory. This problem occurs even if I don't use QImage object afterwards. Neither deleting variables and qrunnable nor…
1
vote
0 answers

PyQt5; Problem with QRunnable and QThreadPool

Referring to: How to pass parameters to PyQt QThreadPool running function I am trying to apply the above topic to my code to avoid GUI freezing, the issue that fails to create a pushbutton within the TableWedgit in fn(push) and (setCellWidget) when…
abubasil
  • 11
  • 2
1
vote
0 answers

why can't i use a QRunnable object in this case?

I am using the PyQt framework to create a GUI which will display the feed from two cameras (attached via USB) simultaneously. So far, I am working on displaying just the one camera in the GUI window and my code may be summarised as follows: from…
andra_16
  • 21
  • 2
0
votes
0 answers

Qt GUI application crashes calling QThreadPool start two times

I'm trying to use QThreadPool on a QRunnable-base class The code is the following void Window::on_randomBtn_clicked() { QString value; _pool.start(_randomizer); _pool.waitForDone(); value = _randomizer->value(); …
0
votes
0 answers

Getting results from subthread to main thread in other way than signals

It possible to obtain results from the Worker object (QRunnable subclass) in other way than signals? The reason for this is that I don't think (please correct me if I'm wrong) that signals should be used for sending large amounts of data e.g. like…
LukaszPe
  • 57
  • 1
  • 16
0
votes
0 answers

What problem causes exit code -1073741819 (0xC0000005) while pyqtSignal.emit()?

I use pyqt5 and python 3.9 in PyCharm. This is my minimal code import sys from PyQt5.QtCore import QObject, QRunnable, pyqtSignal, QThreadPool from PyQt5.QtWidgets import QMainWindow, QApplication class Launcher(QRunnable, QObject): …
0
votes
0 answers

QProgressBar stuck when QRunnable runs a loop function passed in

I have a calculating function that need to be sent to Qrunnable Worker as a parameter. Then, the calculating function runs with a 0-100 loop calculating in Worker's run function. The Problem is: the function is a separate loop function, I want to…
NorthBig
  • 47
  • 1
  • 9
0
votes
0 answers

What is the best way to stop (interrupt) QRunnable in QThreadPool?

I have a long running task, which for example's sake I have made an infinite while loop: def long_task(parent, progress_callback): top = 100000 x = 0 while True: if x < top: if not parent.stop: …
Toakley
  • 182
  • 3
  • 13
0
votes
1 answer

How to stay in QRunnable with async code (e.g. QWebEnginePage.load() or QWebEnginePage.printToPdf())

I have this demo program that is not working as I would wish: import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtPrintSupport import * from PyQt5.QtWebEngineWidgets import * class…
nenad
  • 164
  • 6
  • 17
0
votes
3 answers

Why is GUI responsiveness impaired by a Worker thread?

I'm trying to understand why this Worker thread, which deliberately uses a fairly intense amount of processing (sorting of these dictionaries in particular) causes the GUI thread to become unresponsive. Here is an MRE: from PyQt5 import QtCore,…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
0
votes
1 answer

PyQt5 Use a QRunnable to launch other QRunnables

I am struggling (a lot) with a problem: I am launching a process that requires some computational resources and sometimes takes a lot of time. Since I cannot kill a running QRunnable with a button, I would like to use a QRunnable that launches no…
linksse
  • 33
  • 4
1
2