-
Hi textual team! I hope you're well, as I love your projects so very much! They've made 🐍 cli/tui work so wonderful 💙 💛 Is there a way to display the default key bindings at all?I haven't really assigned new ones, outside of q to quit, but I do want to show new users about default textual key bindings. An example would be explaining that tab allows you to focus onto the next area. When adding this to the footer, it only displays the q to quit text in the footer, but none of the other keys. Here's a snippet: #!/usr/bin/env python3.11
from textual import on
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll, Container, Horizontal, HorizontalScroll
from textual.binding import Binding
from textual.events import Mount
from textual.widgets import Button, Footer, Header, Input, Label, RadioButton, RadioSet, Rule, SelectionList, Static, Switch, TabbedContent, TabPane
from textual.widgets.selection_list import Selection
class ConfigureAll(App):
"""
class helps the user configure specific custom values for applications such
as hostnames and timezones
"""
CSS_PATH = "./css/configure_all.tcss"
BINDINGS = [
Binding(key="tab",
action="focus_next",
description="Focus Next",
show=True,
priority=True),
Binding(key="shift+tab",
action="focus_previous",
description="Focus Previous",
show=True,
priority=True),
Binding(key="q",
key_display="q",
action="quit",
description="Quit smol-k8s-lab"),
Binding("left", "previous_tab", "Previous tab", show=True, priority=True),
Binding("right", "next_tab", "Next tab", show=True, priority=True)
]
def compose(self) -> ComposeResult:
"""
Compose app with tabbed content.
"""
header = Header()
header.tall = True
yield header
# Footer to show keys
yield Footer() I read about bindings here, https://textual.textualize.io/guide/input/#binding-class :
Is there some way to ensure certain default bindings do appear in the footer? Is there a hidden option to make it work anyway? Here's an example of what currently happens: If you notice, at roughly 3 seconds into the video, the other bindings, aside from the quit binding, do show up, before being hidden again immediately. I don't know if it's helpful, but you can view the whole file of code I'm writing with @cloudymax here (we're actively working on it, so I've pinned it to a specific commit): We're using Python 3.11.4 and textual 0.36.0. I found these issues, but I am still confused: Is the issue that nested in my tabbed content further down in the file, I have scrolling containers? I need those for now, I think, unless I'm missing something, which could absolutely be the case. Is there a work around or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
No, there isn't a hidden option for this (we don't really have "hidden options" -- internals that may change from release to release and can't be relied on, sure, but not stable hidden options; if something is a stable option we'll generally publish it in the docs). When it comes to the usual navigation keys, as you've noticed, there isn't really a method of getting them to show in the Our aim is to revisit the way that users can discover bindings, either via the In your case I think, for your app, if your users need to be able to learn the basic navigation keys, perhaps it makes more sense to have a |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
No, there isn't a hidden option for this (we don't really have "hidden options" -- internals that may change from release to release and can't be relied on, sure, but not stable hidden options; if something is a stable option we'll generally publish it in the docs).
When it comes to the usual navigation keys, as you've noticed, there isn't really a method of getting them to show in the
Footer
if they're configured to not show. One of the reasons for this is that, quite quickly, theFooter
would get overwhelmed with keys and many would disappear off the edge of the footer and the user wouldn't be able to see them.Our aim is to revisit the…