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..33acb6d --- /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
{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Wa=/["'&<>]/;Vn.exports=Ua;function Ua(e){var t=""+e,r=Wa.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i