Windows alternative: multiprocessing.connection.wait on Pipe, Tkinter File Handlers

Josh Jacobson joshmjacobson at gmail.com
Mon Oct 23 12:34:52 EDT 2017


The two functions in the subject are not fully implementable on Windows,
and so I am looking for an alternative.

Relevant SO postings including full code and description, with bounty:
Freezes
<https://stackoverflow.com/questions/46797770/tkinter-application-freezes-while-continually-polling-pipe-for-contents-multi>,
Input
<https://stackoverflow.com/questions/46778491/how-can-i-implement-an-input-method-in-a-tkinter-parent-script-with-the-displ>

----

I have two scripts:

*Processor_child.py*: Its purpose is to perform a number of data analysis
and cleaning operations. This must perform the same operations when run
alone (without Tkinter_parent.py) as it does when packaged into a GUI with
Tkinter_parent.py.

*Tkinter_parent.py*: Its purpose is to provide a GUI for those who can't
use Processor_child directly.Within Processor_child, there are for loops
that ask the user for input on each iteration. These prompts need to appear
in the Tkinter app, accept the input, and send it back to Processor_child.

----

The main issue is having the script not move forward on execution until
input has been sent.

I know of three ways to theoretically solve this, but *none of these work
in production on a Windows machine*:

1. while pipe1.poll() != True:

        time.sleep(0.1)

This causes constant loading and a "freezing" like user experience.

2. multiprocessing.connection.wait

>From the documentation: ""Windows: ... Note that pipe handles and socket
handles are not waitable handles."

3. Tkinter file handlers

>From the documentation: "This feature is not available on Windows."


*Given that none of the 3 available options works on Windows, what options
are available for Windows machines?*

See Tkinter application 'freezes' while continually polling Pipe for
contents (multiprocessing)
<https://stackoverflow.com/questions/46797770/tkinter-application-freezes-while-continually-polling-pipe-for-contents-multi>
and How can I implement an `input` method in a Tkinter parent script, with
the displayed prompt and return value being sent back to a child script?
<https://stackoverflow.com/questions/46778491/how-can-i-implement-an-input-method-in-a-tkinter-parent-script-with-the-displ>
for further description and code samples.



More information about the Python-list mailing list