[issue27546] Integrate tkinter and asyncio (and async)

Guido van Rossum report at bugs.python.org
Thu Jul 21 15:35:07 EDT 2016


Guido van Rossum added the comment:

> Who actually wrote it [crawl.py], that would understand it?

I wrote it, and I can probably still recover my understanding of it.  Basically you say "python3 crawl.py xkcd.com -q" and it crawls the XKCD.com website -- that takes about 4 seconds on my machine, fetching 1764 urls. The -q is to make it more quiet while it's working -- but somehow it doesn't suppress the final report, which includes a full list of all crawled URLs -- this could use some surgery to pass the log level into Fetcher.report().  A test site that has only one URL is www.pythonlabs.com.

I ran the test program (tkaloop.py) and it appears to work, with one caveat: updates in response to Tk events (specifically clicking the button that toggles the color of the "Hello" label) seem to take an effect only once the self.root.update() call in your run_forever() is made, which appears to be only once per "interval" (i.e. 1 second).

Hopefully future development will make it so that when a Tk event happens, *somehow* the asyncio selector gets woken up.

(PS. Please don't abbreviate asyncio to aio. It makes your code harder to read for asyncio veterans. :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27546>
_______________________________________


More information about the Python-bugs-list mailing list