> 
> On Dec 4, 2019, at 4:53 PM, Kerby Geffrard <kerby.geffr...@autodesk.com> 
> wrote:
> 
> I think you can try to use a QThread for this.

I was under the impression that QThreads had the same limitations that regular 
python threads had, but I’ll give it a shot. The need to subclass QThread 
rather than simply being able to execute a function complicates things however 
- I have to make sure that said subclass has access to all the original class 
members it needs.
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> 
> Le 4 déc. 2019 à 18:41, Israel Brewster <ijbrews...@alaska.edu> a écrit :
>> 
>>  I know this is a FAQ, however I haven’t been able to make any of the 
>> standard answers work for me. Here’s the situation:
>> 
>> - using PySide2 5.12.2
>> - I have an object (QMainWindow subclass) that contains most of the code for 
>> my application
>> - One of the functions that runs in response to user input takes around 2 
>> seconds to run. The GUI obviously freezes during this time (BAD!)
>> - Said function needs to access and modify several large variables (pandas 
>> data frames) from the main object
>> 
>> So here’s the problem: If I run this function as a separate (python) thread, 
>> that doesn’t help - the GUI is still frozen. I’m thinking this is due to the 
>> GIL, but I could be wrong about that. Running under the multiprocessing 
>> module, however, doesn’t appear to be an option due to the number and size 
>> of the data structures that the function needs to modify, and if I try just 
>> to see what happens, the process actually crashes.
>> 
>> So what are my options here? How can I keep the GUI responsive while this 
>> function runs, without being able to spin it off as a separate process? Or 
>> is the only option going to be to completely rip apart the function and try 
>> to re-build it in such a way that it can, somehow, still access the memory 
>> from the main thread, while doing the processing in a separate function?
>> ---
>> Israel Brewster
>> Software Engineer
>> Alaska Volcano Observatory 
>> Geophysical Institute - UAF 
>> 2156 Koyukuk Drive 
>> Fairbanks AK 99775-7320
>> Work: 907-474-5172
>> cell:  907-328-9145
>> 
>> _______________________________________________
>> PySide mailing list
>> PySide@qt-project.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.qt-2Dproject.org_listinfo_pyside&d=DwIGaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=Sh-EhW_r32FEgrsAfK3Hc0du2ebOZ7PrbchABO_xtMo&m=r4Ron7tNrQN9BNhzXVlsKvYoyWrnjjOzLwALVV_CgnA&s=T2UjSQWTnYFAfFbfdTlMgLZnfC1dlXhNy1SmPijkWbs&e=
>>  

_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to