'How to run two python event loops and share the same memory?
I am using twisted and PySide2 to create an app that can send information through network. However, twisted's reactor and PySide2's QApplication both need an event loop that runs forever.
What I need is when twisted receives a new message, I want it to update the message in the PySide2 Window. So that means twisted and PySide2 need to share the same memory. Here's some sample code:
def dataReceived(self, data): # a function inside a twisted class
QLabel.setText(data.decode()) # a pyside2 object
I cannot use threading, because twisted and PySide2 both needed to be in the main thread; And multiprocessing can't share memory like QWidget objects.
So how can I run these two event loops at the same time, and let them share the same memory?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
