1,534 questions
3
votes
2
answers
104
views
How do I stop an event loop in a QThread?
I have a QThread with a while loop. I need to be able to stop that loop. I tried to emit a signal from the main thread connected to a slot in the QThread that sets a variable to true and thus ends the ...
1
vote
0
answers
94
views
PySide6 QThread with Worker never emits finish signal
Before asking the question, I am aware of people having similar problems and reviewed similar questions, but I did not find the answer.
I have tried to follow the example from here to do proper ...
0
votes
1
answer
46
views
Socketio background task issues with pubsub subscription
I am running a gunicorn server with 1 eventlet worker through which I communicate with the FE via websockets.
However, I also need to listen to an external pod running some code that will emit a redis ...
3
votes
1
answer
73
views
QThread for an indefinite non-looping lifecycle
I understand how QThread is supposed to be used conceptually, with something akin to the following
MyWorker *worker = new MyWorker();
QThread *thread = new QThread();
worker->moveToThread(thread);
...
0
votes
1
answer
127
views
QThread/QProcess issue: Process won't terminate and crashes occur
Currently, I'm learning QThread and QProcess, so I want to create a process monitoring demo. However, I encountered two issues that I couldn't resolve.
Issue:
QProcess can successfully start a process ...
0
votes
0
answers
68
views
When decoding a video using ffmpeg and playing it with qt, the image is not refreshed
This is the code in the main thread.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
Ffplay f;
QObject::connect(&f,&Ffplay::send,&w,&...
2
votes
2
answers
219
views
Waiting for a PyQt/PySide.QtCore.QThread to finish before doing something
I have a data acquisition thread which samples and processes data which it then emits as a signal to a receiver.
Now, when that thread is stopped, how can I ensure it has finished the current loop and ...
1
vote
0
answers
24
views
What is the right way to close a pair of QThread/Process?
In my main pyqt5 program i instantiate some classes.
Each of this classes are born a QThread and a Process.
I am having trouble closing all this pairs of QThreads/Processes.
Here is what i do:
main ...
0
votes
1
answer
50
views
In Qt, why calling a thread object's wait() function prevents it from receiving signal?
QThread *ptr=new QThread();
Worker *pwk=new Worker();
ptr->setObjectName("Worker thread");
pwk->moveToThread(ptr);
QObject::connect(ptr,&QThread::started,pwk,&...
1
vote
0
answers
82
views
QThread msleep() vs. QTimer in PyQt5: Key Differences, Best Practices, and Use Cases [duplicate]
I am working on a PyQt5 application where I need to perform periodic tasks. I've come across two primary approaches:
Using time.sleep() or QThread.msleep() in a subclass of QThread.
Using QTimer.
...
0
votes
0
answers
131
views
Interrupt expensive SciPy calculations
Is there a way to programmatically interrupt expensive operations like curve_fit from SciPy? In the application I’m developing for a client, I need to perform expensive calculations with maxfev set (...
1
vote
1
answer
149
views
`QObject.moveToThread` does not take a slot with it in PySide6
I am troubleshooting a threading application and I noticed the following behaviour: in PySide6, I would like to connect to both slots and non-slot methods, which accoridng to documentation should work....
2
votes
1
answer
92
views
In a multi-level QThread, QProcess readyReadStandardOutput is unable to output normally
When I use AllocateParallel to control the maximum number of executions, no messages are generated for Task's start_output and output. However, when I run only with Task, both start_output and output ...
0
votes
0
answers
42
views
Modify UI via a lot of other threads than the main thread
I am developing a program that downloads comics from a website. The program has a search engine that allows users to search. Each time a letter is typed, a GET request is sent to the site, and the ...
1
vote
0
answers
20
views
pyside6 How to continuously display output in a textbox in real-time [duplicate]
I want to use a for loop to display numbers from 0 to 4 in a textbox in sequence. However, the output is displayed all at once after the loop finishes. I don't know how to make it display in real-time....
0
votes
2
answers
65
views
The signal emmited from UnixDomain datagram socket server running on a QThread never received
The Files which I've created
I've created WorkerThread class extended QThread as follow:
// https://stackoverflow.com/a/14546167/11073131
#ifndef THREAD_H
#define THREAD_H
#include <QThread>
#...
1
vote
1
answer
43
views
PyQt5 - QThread subclass that reimplements run() but also handles events
This link explains that QThread can be used in one of two ways:
A QThread instance that runs a default event loop. You can dispatch events to be executed by the thread using signals and a worker ...
0
votes
0
answers
47
views
Ensuring two task in a QThread don't overlap
I'm writing an application using PyQt6 to monitor and control an external serial device, and thus I need to send both read and write instructions, taking around 100ms to get a response.
I've created a ...
0
votes
0
answers
88
views
PyQt6 QThread not working with high computational tasks
I'm working on a PyQt6 GUI that needs to call a function from a pyo3 library in the background, which performs very expensive calculations on a very large amount of data (we're talking about vectors ...
0
votes
1
answer
64
views
Prevent specific key presses from being sent to foreground app using PyQt5 and pynput
So I want to detect certain keys being pressed and stop those keys being sent to the foreground app.
I don't want to use hideous libraries like pywin32 and pyHook as they are such a headache to build. ...
1
vote
1
answer
358
views
pyqtSignal emit multi type [duplicate]
I have a signal to be: auto_dj_start = pyqtSignal(dict,str,dict,str)
Sometimes when the player list is empty i want to emit None to all parameters instead of dicts and string.
But this error happens:
...
0
votes
0
answers
219
views
thread crashes with SIGSEGV or SIGABRT
I am writing a python wrapper for rsync (one more ;-) and use Qt to display the output of rsync. I realize that when have verbose output for each file my program crashes with SIGSEGV or SIGABRT. I ...
0
votes
0
answers
73
views
PyQt5 - Using multiprocessing for matplotlib purposes
With this code i am trying to plot a pydub.AudioSegment signal which has duration=125msec.
The plot time window (x-axis) is 3 sec.
code:
import time
from PyQt5.QtCore import pyqtSignal, QThread
from ...
0
votes
0
answers
54
views
In a well-running multithreaded app, a defined callback will not be called. Why?
I have a program that starts five threads. Every single thread says 'Hello World!' to the console. At the end of a thread a callback function should be called. This outputs 'Goodby folks' to the ...
1
vote
0
answers
132
views
How to use websocket running on separate QThread of PyQt application?
I have a PyQt GUI application that is also running a FastAPI webserver via Uvicorn on a separate thread. This server has a websocket endpoint. I would like to be able to send messages on this ...
0
votes
1
answer
144
views
how to download file using subprocess and update QProgressBar in PyQt6
I am writing a program to download a bunch of files, the program is very long, I download the files by calling aria2c.exe via subprocess, and I have encountered a problem.
Specifically, when using ...
0
votes
1
answer
132
views
How to make QThread quit a process?
I am a beginner at UI development using PySide6, but due to certain circumstances, I have to design a UI for a program that I have created. In one of the windows of this UI, I have a QObject called ...
2
votes
0
answers
380
views
How to know in which thread widget are created in PySide6?
I am trying to implement multi-thread in a QT application developed with PySide6.
Starting from this example I have a code which looks like the code below.
The below code works well, without error. In ...
0
votes
0
answers
152
views
PyQt5, Qthread. Process finished with exit code -1073740791 (0xC0000409)
Good day. I can’t figure out why the program crashes with the error Process finished with exit code -1073740791 (0xC0000409). When one client connects, everything works fine, but when a second client ...
-2
votes
1
answer
128
views
How to block a thread until a slot is received
I'm using Qt 6.6.1.
I defined a class MyThread:
class MyThread: public QThread
As an inner class, I defined a class WakeUpEvent in the private section of the .h file:
private:
class WakeUpEvent : ...
2
votes
0
answers
42
views
Python QWidget Controls not Showing in a Form
I have a Main GUI class, and I am attempting to open another window, I am using QWidget to inherit from. The window that opens is just a progress bar and there is a QThread timer in another class in ...
3
votes
1
answer
176
views
The attempt to terminate a function in a thread using signals fails in PyQt6
I have a time-consuming thread operation, but it cannot emit progress during the processing. So, I use another thread to simulate its progress. When the time-consuming operation is completed, it emits ...
0
votes
0
answers
52
views
How to continue application after waiting a thread return results
I want to continue application after waiting a thread complete in PyQt5. In this code, self.capture_handle.relabeling_thread() gets current image in widget and after display it into new widget. I use ...
0
votes
1
answer
132
views
why can't i close a QThreadPool?
i am trying to create a loading screen using PyQt6 for my functions (which sometimes take too long of a time), and i am using a QThreadPool to move those functions into a different thread, here is my ...
0
votes
0
answers
52
views
QT passing data between threads, worker function doWork() doesn't start
I'm new in Qt and I have a problem. I'm trying send data from worker thread using signal dataReady to slot in mainwindow updateData.
My problem is that my doWork function doesn't starts and don't emit ...
0
votes
1
answer
204
views
PySide or PyQT: using signals and slots to update GUI QLabel during QThread process
I am running a long process with QThread. In this process I send a signal to a slot. I want that slot to update a QLabel with setText(). I have ensured that my QThread process is on a separate thread ...
4
votes
1
answer
758
views
Can not change media using setSource() in pyside6
I have some video clips named 0.mp4, 1.mp4, 2.mp4... and I am using QMediaPlayer in PySide6.
I want to write a media player which can play videos one by one. At the end of each video clip, I use the '...
0
votes
0
answers
213
views
How to make GUI wait for user input to continue running code [duplicate]
I am creating a GUI with python (v3.9) and PyQt6 for a program I developed. At the moment I am trying to find a way in which the moment a user clicks a button, a for loop starts. Within this for loop ...
0
votes
1
answer
380
views
Can I call a QObject method from main thread after moveToThread() method is called?
I have a worker class
class Worker(QObject):
finished = Signal()
def __init__(self, n):
super().__init__()
self.a_flag = False
# self.mutex = QMutex()
# @Slot()
...
0
votes
1
answer
130
views
When there are multiple QTimers in the same QThread, why are the tasks associated with the QTimer executed serially?
I'm trying to run multiple timers in one QThread, I expect each timer to be independent.
But the final running result is not what I expected. All timers seem to be executed serially.
For example, in ...
0
votes
2
answers
546
views
PyQt5 application not responding during operation if any event is noticed by the app
I have created a simple application to replicate this issue.
Basically, if you click away or click on the app (replicating an event that is handled by the application), then it sets it into the queue ...
0
votes
0
answers
35
views
Why is my gui blank while a QThread is tunning
PyQt6 py 3.11.5
whenever i run this specific gui application in a thread, it doesnt show anything until the thread quits. (i removed some functions that werent relevant but the problem still happens)
...
0
votes
1
answer
134
views
Multithreading using QxOrm MONGODB, using different databases for each thread
According to QxOrm manuals : 3.2 and 3.22,
it seems to be possible to use
qx::QxSqlDatabase::getSingleton()->setDatabaseName("./test_qxorm.db");
qx::QxSqlDatabase::getSingleton()->...
0
votes
0
answers
109
views
Check for pattern in a non-blocking manner using PyQt6
I have a method command(self, command, data), part of a class CommandProcessor that checks a buffer for a specific pattern and then returns it content:
command(self, message):
serial_port.write(...
0
votes
0
answers
65
views
How do I properly stop new qthread after it receives signal from main thread?
I have 2 threads in my Qt app. Main thread and myThread. I want myThread to stop whenever it receives workFinished signal from corresponding Worker class OR when it receives stopMyThread signal from ...
0
votes
1
answer
77
views
GUI is blocked when it signals the slot of a QThread object
I am trying to create a QThread object whose task will be to handle all the requests from different widgets to play signals on the sound card. I name this object 'sound_engine' and keep it as the only ...
0
votes
0
answers
260
views
VTK Render Window and QThread synchronization Issue
I am currently working on developing a utility for visualizing data collection. I have created a PyQt5 GUI, and I am using the vtk library to visualize live data from an external source. My current ...
0
votes
1
answer
341
views
python face_recognition library doesn't multi-threaded due to GIL
I'm building a facial attendance application with Python. I use PyQt5 to build UI (in the below code, both PyQt5 and PyQt6 share the same syntax), OpenCV (cv2) to take webcam frames and ...
4
votes
0
answers
128
views
Segmentation fault while creating QTextEdit
I wrote a minimal example in which my application crashes. I can't figure out what's wrong. I hope someone has thoughts about the reason for this segfault.
if you increase the QTimer timeout, for ...
0
votes
1
answer
209
views
QT5's QApplication::setOverrideCursor(Qt::WaitCursor); is blocking the previous operations
In my loadDatabase function, I have clearly set the status to display the message "loading coverage database..." before setOverrideCursor(Qt::WaitCursor), but the status bar is only ...