Skip to content
Discussion options

You must be logged in to vote

If I were to do this I'd probably make my own custom TabPane class for each of the panes that need the different bindings. Also, if there's a common set of bindings, I'd probably implement them in a base class for the other panes. For example:

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import TabbedContent, TabPane, Button, Footer

class BasePane(TabPane):

    BINDINGS = [
        Binding("f1", "something", "First thing"),
        Binding("f2", "another_thing", "Second thing"),
    ]

class FirstPane(BasePane):

    def compose(self) -> ComposeResult:
        yield Button("This is the first pane")

class SecondPane(BasePane):

    B…

Replies: 1 comment 2 replies

Comment options

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

@davep
Comment options

Answer selected by jakubziebin
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