0
votes

From my wxpython GUI app I have an rsync task that I kick off as a multiprocessing.Process.

The idea is to update a wx.textCtrl with the constant output from this background process.

I am using a pubsub subscribe method.

The functions work fine but I can't get the textCtrl to update.

If I use a CallAfter method I get this crash/error:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC() to debug.

If I don't use that method and I try to append the text directly to the textctrl nothing happens.

Any ideas?

Thanks!

Adam

1
try to generate custom events - user6320679
Sounds like you are trying to run wx commands from the remote process. You could instead start and monitor rsync from a thread, then use PostEvent to add it to the event loop for textCtrl frame in the GUI thread. - Neapolitan
Thanks Neapolitan I'll check out PostEvent - adamteale

1 Answers

1
votes

The problem is that the child process can't write back to the main process. Use a queue to pass messages back to the main process, and update the control from within a timer or a background thread that waits for messages from the queue.