-
Even if set Binding("ctrl+q", "quit", "Quit"), the ctrl+c still can quit the app. |
Beta Was this translation helpful? Give feedback.
Answered by
davep
Sep 8, 2023
Replies: 1 comment 1 reply
-
Binding a different key to call from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Label
class QuitApp(App[None]):
BINDINGS = [
Binding("ctrl+q", "quit"),
Binding("ctrl+c", "do_not_quit"),
]
def compose(self) -> ComposeResult:
yield Label("Press Ctrl+Q to quit, don't press Ctrl+C!")
def action_do_not_quit(self) -> None:
pass
if __name__ == "__main__":
QuitApp().run() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Tim-Cao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Binding a different key to call
quit
won't override any other binding for the same action, so that won't remove the binding for Ctrl+C. What you could do is bind it to an action that does nothing: