Skip to content
Discussion options

You must be logged in to vote

After quite some tinkering I think I have found a way to make this work. Looks like there are multiple key aspects:

  1. I need to create a separate asyncio task for my binding action to make sure the main App event loop does not get blocked
  2. I can unmount my Input widget upon on_input_submitted
  3. I can use App.is_mounted(widget) to check whether or not my input object has been unmounted during my get_input method

I am posting the code below in case you have some suggestions on how it might be improved further:

import argparse
import asyncio

from rich.prompt import Confirm, InvalidResponse
from textual.app import App
from textual.widgets import Input, Static


class TextualPrompt(Confirm):
    t…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mrossinek
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mrossinek
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