A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://python-prompt-toolkit.readthedocs.io/en/master/pages/advanced_topics/asyncio.html below:

Website Navigation


Running on top of the asyncio event loop — prompt_toolkit 3.0.50 documentation

  1. Start
  2. Advanced topics
  3. Running on top of the asyncio event loop
Running on top of the asyncio event loop

Note

New in prompt_toolkit 3.0. (In prompt_toolkit 2.0 this was possible using a work-around).

Prompt_toolkit 3.0 uses asyncio natively. Calling Application.run() will automatically run the asyncio event loop.

If however you want to run a prompt_toolkit Application within an asyncio environment, you have to call the run_async method, like this:

from prompt_toolkit.application import Application

async def main():
    # Define application.
    application = Application(
        ...
    )

    result = await application.run_async()
    print(result)

asyncio.get_event_loop().run_until_complete(main())

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4