Comments (4)
I assume you mean when focusing a widget programmatically. Is my quick attempt at an example below a fair representation of this issue, where you would expect the tabs to switch automatically?
from textual.app import App, ComposeResult
from textual.widgets import Button, Footer, TabbedContent, TabPane
class ExampleApp(App):
BINDINGS = [("space", "focus_button_2_2", "Focus button 2.2")]
def compose(self) -> ComposeResult:
with TabbedContent(id="tabbed-root"):
with TabPane("[red]Parent 1[/]"):
with TabbedContent():
with TabPane("[red]Child 1.1[/]"):
yield Button("Button 1.1", variant="error")
with TabPane("[red]Child 1.2[/]"):
yield Button("Button 1.2", variant="error")
with TabPane("[green]Parent 2[/]", id="parent-2"):
with TabbedContent(id="tabbed-parent-2"):
with TabPane("[green]Child 2.1[/]"):
yield Button("Button 2.1", variant="success")
with TabPane("[green]Child 2.2[/]", id="child-2-2"):
yield Button(
"Button 2.2",
variant="success",
id="button-2-2",
)
yield Footer()
def action_focus_button_2_2(self) -> None:
# self.query_one("#tabbed-root", TabbedContent).active = "parent-2"
# self.query_one("#tabbed-parent-2", TabbedContent).active = "child-2-2"
self.query_one("#button-2-2", Button).focus()
if __name__ == "__main__":
app = ExampleApp()
app.run()
from textual.
@TomJGooding Yes - I mean programmatically. Looks like your example captures it :)
from textual.
That's for the MRE Tom!
from textual.
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
from textual.
Related Issues (20)
- v0.68.0 test_deadlock is failing HOT 12
- Some minor documentation additions HOT 3
- Add Image support using imgcat HOT 6
- Callback is not called when Screen is dismissed HOT 13
- `Tree.select_node` doesn't select the node, it highlights it HOT 5
- Using standard python logger HOT 3
- Documentation is not up-to-date HOT 3
- Travel back in time to 1900 HOT 2
- Crash opening and closing dialog really fast HOT 25
- On exit Texual always prints a lonely "<" to console HOT 3
- Workers report RUNNING state twice HOT 4
- Allow mouse-resizable Grid/Vertical/Horizontal with click-hold-drag-release type of resizing HOT 1
- Deadlock when closing app, associated with Footer.recompose and focus events HOT 5
- Right and bottom gets cut from keyline when using auto for width and height HOT 3
- MD links inside a MD table in Markdown Widget do not generate Markdown.LinkClicked when clicked HOT 2
- Update documentation HOT 2
- "Can't mount widget(s) before Vertical() is mounted" when reactive recompose HOT 1
- Pasting "〽️" in TextArea Moves Cursor Too Far HOT 12
- Crashes on 0.71.0 when pushing/popping screens quickly HOT 12
- Textual 0.71 introduces another deadlock in Memray's test suite HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.