[Python-ideas] Yielding from the command line

Martin Teichmann lkb.teichmann at gmail.com
Fri Sep 12 09:33:04 CEST 2014


Hi Terry, Hi List,

> I presume full behavior requires the call to root.mainloop().  This has two
> problems for continued interaction.  First, the call blocks until the window
> is closed, making further entry impossible through normal means.  If that
> were solved with a 'noblock' option, there would still be the problem of
> getting shell input to a callback that could, on demand, execute to code to
> modify the tk app.  The solution would have to be different for the console
> interpreter, there tkinter is running in the same process and Idle, where
> tkinter is running is a separate process.

You just gave a good reasoning for the advantages of asyncio. Because once
we have an asyncio-aware version of tkinter - and an asyncio-aware command
line, this is what I am proposing - all the problems you just described
disappear. So, I would call that a good use case for my idea.

A tkinter-aware commandline would then just look like:

    set_event_loop(TKInterEventLoop())
    async(commandline()) # i.e. the coroutine defined in my last post
    get_event_loop().run_forever() # this calls root.mainloop()

Greetings

Martin


More information about the Python-ideas mailing list