New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a tutorial for AsyncIO in the documentation #71766
Comments
The documentation of AsyncIO is well written for a developer, but it's a reference. We have the description of all the methods, classes, etc... But we want to learn to develop with AsyncIO, it's difficult, because there is no many examples in this reference and we have to look for some examples on Internet. Could we add a AsyncIO tutorial|cookbook|howto ? because we have a "Logging Cookbook" but not a "AsyncIO 101". Thank you Stephane |
I guess someone has to step forward -- i can propose an initial patch with the tutorial. |
The tutorial is happening but outside Python: I suggest to now close this issue. |
I would like the tutorial to include something like the following. Adding Tkinter GUI to Asyncio Program Assuming that the tkinter Tk instance is called 'root' and the asyncio loop is called 'loop', add the following callback loop. def tk_update():
root.update()
loop.call_soon(tk_update) Before each loop.run_forever() or loop.run_until_complete(...) call, add tk_update() Do not call root.mainloop() or root.quit(). Loop.stop() or completion of run_until_complete will stop the tk_update loop. This is the result of my experiments in bpo-27546. One of my tests was running IDLE with an asyncio loop augmented with the above replacing root.mainloop. I don't yet know how to work with git and github. |
Hi Terry,
I don't yet know how to work with tkinter and TK. I propose to combine our respective knowledge to improve the documentation together. If you give an all in one python file example with tkinter, I'll add that in the documentation via git and Github. Thanks for your help. Have a nice day. |
"I would like the tutorial to include something like the following: Adding Tkinter GUI to Asyncio Program" Please open an issue in the asyncio-doc project: There is now a small community working on this documentation project, so I don't think that it's worth to keep this issue open. But today, Tkinter is not really fully integrated with asyncio. So I'm not sure that it's only a matter of *documentation*, it's more a matter of code that should be written and/or completed no? Or maybe open a thread on the new async-sig mailing list? |
Ludovic: Thank you for the offer. When I post a proposed text with code to bpo-27546, I will nosy you if you have not already done so by then. Viktor: 'full integration' by adding a tk update in the standard _run_once is not possible as tkinter is not always present. I started bpo-27546 by creating a custom subclass, but that requires dealing with the Selector and Proactor subclasses and default loop policy and still will not work with independent implementations. I considered a tk-loop implementation, but speed tests do not make that very inviting. The simple code I then tried is my current best recommendation. It will work with any asyncio compatible implementation. Besides the test with IDLE, Guido tested it with Examples/crawl.py, and I will improve on that. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: