[PyQt] Any way to run code before each QThread?
Ned Batchelder
ned at nedbatchelder.com
Mon Jul 16 01:19:03 BST 2018
On 7/15/18 12:06 PM, John Ehresman wrote:
> On 7/15/18 11:46 AM, Phil Thompson wrote:
>> Should I implement QThread.settrace()?
>>
>> If so can somebody clarify what thread the call to sys.settrace()
>> should be made in? The new thread or the thread from which the new
>> thread is created?
>
> It would be better to use the callback function that is passed to
> threading.settrace than to add QThread.settrace. It's available as
> threading._trace_hook The sys.settrace function should be called on
> the new thread before any Python code on that thread.
>
> The ugly hack that Wing's debugger uses is to wrap to run method of a
> QThread instance that sets up the debugger for the thread and then
> calls the original run method.
How does Wing wrap the run method? How does it get a chance to do that?
--Ned.
More information about the PyQt
mailing list