Coder Social home page Coder Social logo

Comments (2)

davep avatar davep commented on May 28, 2024

Testing with a standalone bit of code:

from textual.app        import App, ComposeResult
from textual.binding    import Binding
from textual.containers import Horizontal, Vertical
from textual.widgets    import Header, Footer, TabbedContent, TabPane, Tabs, Label

class StandardTabs( Vertical ):

    def compose( self ) -> ComposeResult:
        with TabbedContent():
            for n in range( 10 ):
                with TabPane( f"Tab {n}" ):
                    yield Label( f"This is tab {n}" )

class SelfSwitchTabs( StandardTabs ):

    BINDINGS = [
        Binding( "a", "previous", "Previous" ),
        Binding( "d", "next", "Next" ),
    ]

    def action_previous(self) -> None:
        self.query_one(Tabs).action_previous_tab()

    def action_next(self) -> None:
        self.query_one(Tabs).action_next_tab()

class TabbedContentTesterApp( App[ None ] ):

    CSS = """
    StandardTabs:focus-within {
        background: $panel;
    }
    """

    def compose( self ) -> ComposeResult:
        yield Header()
        with Horizontal():
            yield StandardTabs()
            yield SelfSwitchTabs()
        yield Footer()

if __name__ == "__main__":
    TabbedContentTesterApp().run()

and I don't obviously see any sort of issue; using the Tabs itself vs using other bindings to call into the Tabs via its actions doesn't seem to make any difference. Both look the same speed.

from frogmouth.

davep avatar davep commented on May 28, 2024

Handled by some improvements to Textual, and a slightly change to how/when focus is settled on a navigation pane in the application itself.

from frogmouth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.