[PyQt] QThread terminate trouble when porting to Python 3
missive at hotmail.com
Tue Sep 18 23:50:59 BST 2012
I am porting Pynguin to Python 3:
I am working with Python 3.2.3 and PyQt 4.9.1 on Ubuntu.
This is a turtle graphics application, so I take the user's
(python) code and run it in a separate thread. If the
user wants to interrupt the running code, they can press
Ctrl-C and the main thread terminates the thread
that is running the user code.
I know that use of QThread.terminate is discouraged,
but for the most part it works just fine for my use.
The problem I am having is if the user's code is
Should be pretty rare, but the application is aimed at
beginners, and who knows what they might try. Also,
in the previous version I was using, this could be
Now, when trying to interrupt a thread running code like
this, the main thread stops responding and the app must
be killed to escape.
Can this be considered a PyQt bug?
I am considering slipping some monitoring code in to every
loop in the user's code behind the scenes, but that's going to
get pretty complex.
Any other suggestions?
Thanks for your time.
More information about the PyQt