osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

python 3.7 - I try to close the thread without closing the GUI is it possible?


On 09/15/2018 01:23 AM, Albert-Jan Roskam wrote:
>  > I try to close the thread without closing the GUI is it possible?
> 
> 
> Qthread seems to be worth investigating:
> https://medium.com/@webmamoffice/getting-started-gui-s-with-python-pyqt-qthread-class-1b796203c18c

Or better yet, investigate Qt's built-in, asynchronous http request
calls.  I believe the class is QNetworkRequest (and probably other
related classes). This keeps the HTTP request all within the Qt event
loop and eliminates the need for threads.  Additionally it handles all
the problems that might come up, such as connection problems, http
errors, etc.  It looks complicated, but it's simpler than using a thread.