Is there a way to get user input similar to a prompt, for example
from prompt_toolkit import PromptSession
from prompt_toolkit.patch_stdout import patch_stdout
import asyncio
import time
async def echo():
while True:
with patch_stdout():
print(time.time())
await asyncio.sleep(1)
async def read():
session = PromptSession()
while True:
with patch_stdout():
line = await session.prompt_async("> ")
print(line)
loop = asyncio.get_event_loop()
loop.create_task(echo())
loop.create_task(read())
loop.run_forever()
and keep a spinner progress bar like those in https://github.com/pavdmyt/yaspin ? Is there any library able to do this in python other than writing this from a scratch using curses?