question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

As of 0.6.0, bindings on (at least) `left`, `right`, `up` and `down` no longer appear to work

See original GitHub issue

With Textual 0.5.0 I had bindings on the arrow keys that worked fine. Having upgraded to 0.6.0 those bindings no longer seem to work. Isolating the issue I can recreate with this code (some other keys thrown in as control tests)

from textual.app import App, ComposeResult
from textual.widgets import TextLog, Header, Footer
from textual.binding import Binding
from textual.events import Key

class Binder( App[ None ] ):

    CSS = """
    TextLog {
        background: #222200;
        color: #BBBB00;
        text-style: bold;
    }
    """

    BINDINGS = [
        Binding( "up",    "log( 'up' )", "Up" ),
        Binding( "down",  "log( 'down' )", "Down" ),
        Binding( "left",  "log( 'left' )", "Left" ),
        Binding( "right", "log( 'right' )", "Right" ),
        Binding( "a", "log( 'a' )", "a" ),
        Binding( "s", "log( 's' )", "s" ),
        Binding( "d", "log( 'd' )", "d" ),
        Binding( "f", "log( 'f' )", "f" ),
        Binding( "left_square_bracket", "log( '[' )", "[" ),
        Binding( "right_square_bracket", "log( ']' )", "]" ),
    ]

    def compose( self ) -> ComposeResult:
        yield Header()
        yield TextLog()
        yield Footer()

    def on_mount( self ) -> None:
        self.query_one( TextLog ).write( "Ready..." )
        self.query_one( TextLog ).write( "Key bindings being looked for:" )
        self.query_one( TextLog ).write( ", ".join(
            [ binding.key for binding in self.BINDINGS ]
        ) )

    def action_log( self, name: str ) -> None:
        self.query_one( TextLog ).write( f"Via binding: {name}" )

    def on_key( self, event: Key ) -> None:
        self.query_one( TextLog ).write( f"Via event: {event!r}" )

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

Running the above, pressing the arrow keys vs some of the other keys…

Screenshot 2022-12-12 at 11 25 12

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:21 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Dec 13, 2022

They are the same thing for the base class, and most widgets. But it is possible for something to be scrollable that is not a container. I think the only one we have is ScrollView.

0reactions
github-actions[bot]commented, Dec 16, 2022

Don’t forget to star the repository!

Follow @textualizeio for Textual updates.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for a `PRIORITY_BINDINGS` classvar to work ...
For now this is just a draft PR as I work to build up a set of ... As of 0.6.0, bindings on...
Read more >
Re: [RELEASED] MaxVR Oculus Rift Video Player - DK...
NEW: Added key bindings to goto next / prev file in currently used directory. Fixed: Video Filenames with "SBS" "_LR" or "OU" "_TB"...
Read more >
Set up your ski binding correctly! - YouTube
It's really important taht your skibinding is set correctly to your ski boot. It is a simpel thing to do, and all you...
Read more >
How To: Binding Adjustment - YouTube
This video explains how to adjust Atomic Device 310 ski bindings. The concepts explained can be applied to any bindings.
Read more >
kitty.conf - Kovid Goyal
To get a full list of supported fonts use the kitty +list-fonts command. ... which in that font changes the appearance of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found