[Python-Dev] PEP 492: async/await in Python; version 5

Terry Reedy tjreedy at udel.edu
Wed May 6 23:32:11 CEST 2015


On 5/5/2015 10:59 PM, Guido van Rossum wrote:
> For this you should probably use an integration of asyncio (which can do
> async subprocess output nicely) with Tkinter. Over in tulip-land there
> is an demo of such an integration.

After redirection from googlecode tulip, I found
https://github.com/python/asyncio/tree/master/examples
None of the 4 *process*.py examples mention tkinter.

I also found "Create a Tkinter/Tulip integration"
https://github.com/python/asyncio/issues/21
with attachment tk_ayncio.zip
copied (with 'async' replacing 'tulip') to
https://bitbucket.org/haypo/asyncio_staging/src/bb76064d80b0a03bf3f7b13652e595dfe475c7f8/asyncio_tkinter/?at=default

None of the integration files mention subprocess, so I presume you are 
suggesting that I use a modification of one of the example subprocess 
coroutines with the integration framework.

If this works well, might it make sense to consider using an elaboration 
of examples/subprocess_shell.py to replace subprocess socket 
communication with pipe comminication?

> On Tue, May 5, 2015 at 6:03 PM, Terry Reedy <tjreedy at udel.edu
> <mailto:tjreedy at udel.edu>> wrote:

>     My specific use case is to be able to run a program in a separate
>     process, but display the output in the gui process -- something like
>     this (in Idle, for instance).  (Apologies if this misuses the new
>     keywords.)
>
>     async def menu_handler()
>          ow = OutputWindow(args)  # tk Widget
>          proc = subprocess.Popen (or multiprocessing equivalent)
>          out = (stdout from process)
>          await for line in out:
>              ow.write(line)
>          finish()
>
>     I want the handler to not block event processing, and disappear
>     after finishing.  Might 492 make this possible someday?  Or would
>     having 'line in pipe' or just 'data in pipe' translated to a tk
>     event likely require a patch to tk?

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list