Skip to content

How to await for a UI click (for a linear flow)? #290

Closed Answered by falkoschindler
smojef asked this question in Q&A
Discussion options

You must be logged in to vote

Looks like asyncio.Event is your friend: https://stackoverflow.com/a/44892240/3419103

Here is a minimum example:

async def flow():
    clicked = asyncio.Event()
    ui.button('Click me', on_click=clicked.set)
    await clicked.wait()
    ui.notify('You clicked me!')

ui.button('Start flow', on_click=flow)

Regarding the graceful shutdown: Could you, please, open a new discussion with a bit more detail about what you are trying to do? Then it is easier for others to find and we have dedicated space to discuss possible implementations.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by smojef
Comment options

You must be logged in to vote
2 replies
@falkoschindler
Comment options

@falkoschindler
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants