Updating FooterKey
description doesn't work first time?
#4549
Answered
by
willmcgugan
TomJGooding
asked this question in
Q&A
-
I've been experimenting with updating the binding descriptions with the new from textual.app import App, ComposeResult
from textual.widgets import Footer
from textual.widgets._footer import FooterKey
class DynamicBindingsApp(App):
BINDINGS = [("space", "update_footer", "Count: 0")]
count = 0
def compose(self) -> ComposeResult:
yield Footer()
def action_update_footer(self) -> None:
self.count += 1
footer_key = self.query_one(FooterKey)
footer_key.description = f"Count: {self.count}"
footer_key.refresh()
if self.count < 2:
self.notify(
"Footer description is not updated first time.",
severity="error",
timeout=1,
)
if __name__ == "__main__":
app = DynamicBindingsApp()
app.run() |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
May 29, 2024
Replies: 1 comment 1 reply
-
I wouldn't expect this to work. There is no current blessed way of updating the description dynamically. Updating the description like that would be reset when the bindings changed with focus etc. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
TomJGooding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wouldn't expect this to work. There is no current blessed way of updating the description dynamically. Updating the description like that would be reset when the bindings changed with focus etc.