diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..561cd5d --- /dev/null +++ b/404.html @@ -0,0 +1,335 @@ + + + +
+ + + + + + + + + + + + + + +async_handler(async_function, *args, **kwargs)
+
+A helper function which allows to use async functions as command handlers (e.g. button click handlers) or event +handlers.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
async_function |
+
+ Callable[P, Coroutine[Any, Any, None]]
+ |
+
+
+
+ async function + |
+ + required + | +
args |
+ + | +
+
+
+ positional parameters which will be passed to the async function + |
+
+ ()
+ |
+
kwargs |
+ + | +
+
+
+ keyword parameters which will be passed to the async function + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Callable[P, None]
+ |
+
+
+
+ A sync function, which runs the original async function in an async event loop. + |
+
Usage examples: +
import tkinter as tk
+from async_tkinter_loop import async_handler
+
+async def some_async_function():
+ print("Wait...")
+ await asyncio.sleep(0.5)
+ print("Done!")
+
+button = tk.Button("Press me", command=async_handler(some_async_function))
+
+# ----
+
+async def some_async_function(event):
+ print("Wait...")
+ await asyncio.sleep(0.5)
+ print("Done!")
+
+root.bind("<1>", command=async_handler(some_async_function))
+
+# ----
+
+# Also, it can be used as a decorator
+@async_handler
+async def some_async_function():
+ print("Wait...")
+ await asyncio.sleep(0.5)
+ print("Done!")
+
+button = tk.Button("Press me", command=some_async_function)
+
async_tkinter_loop/async_tkinter_loop.py
async_mainloop(root)
+
+A function, which is a substitute to the standard root.mainloop()
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
root |
+
+ Tk
+ |
+
+
+
+ tkinter root object + |
+ + required + | +
async_tkinter_loop/async_tkinter_loop.py
get_event_loop()
+
+A helper function which returns an event loop using current event loop policy.
+ + + +Returns:
+Type | +Description | +
---|---|
+ AbstractEventLoop
+ |
+
+
+
+ event loop + |
+
async_tkinter_loop/async_tkinter_loop.py
main_loop(root)
+
+
+ async
+
+
+An asynchronous implementation of tkinter mainloop. +The function is not intended to be called directly from your code.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
root |
+
+ Tk
+ |
+
+
+
+ tkinter root window object + |
+ + required + | +
async_tkinter_loop/async_tkinter_loop.py