This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients Maxime S, gvanrossum, serhiy.storchaka, terry.reedy, yselivanov
Date 2016-07-25.04:47:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469422054.46.0.387164218032.issue27546@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-07-25 04:47:35gvanrossumsetrecipients: + gvanrossum, terry.reedy, serhiy.storchaka, yselivanov, Maxime S
2016-07-25 04:47:34gvanrossumsetmessageid: <1469422054.46.0.387164218032.issue27546@psf.upfronthosting.co.za>
2016-07-25 04:47:34gvanrossumlinkissue27546 messages
2016-07-25 04:47:34gvanrossumcreate