Guido van Rossum added the comment: OK, I'm playing with this too. I merged your loop_tk.py example with crawl.py and am attaching the result as tkcrawl.py. I don't like global state so I added root and loop as parameters to a few places. Hopefully you have the asyncio repo checked out so you can compare this with the original crawl.py -- it basically has your code (with globals replaced by locals or instance variables) and these three lines in main() once loop is set:
+ root = tk.Tk() + t = asyncio.Task(display_date(root, loop, 100, 1)) + tk_update(root, loop) and a loop.run_forever() call just before the loop.close() call, to keep the app running once it's done. There are also two imports near the top (datetime and tkinter as tk). (Oh, and I just realized I made some changes to crawl.py to suppress displaying the URL of every HTML page retrieved when -q is given. I will commit that.) Running this will display the widget with the hello label and the button to change the color, *and* update the date every second, and it's totally responsive, all *while* it is fetching contents from e.g. xkcd.com. ---------- Added file: http://bugs.python.org/file43873/tkcrawl.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27546> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com