Addresses the issue raised in #939. Here I rework Screen._reset_focus so that, rather than deal with siblings, it deals with the focus chain. It now also optionally takes a list of DOMNodes to avoid and will, as that suggests, avoid them when looking for somewhere to move focus to. As a preference the new version of this will seek to settle focus on the nearest (in the chain) *previous* non-excluded DOMNode. NOTE: Currently the return value of Widget.walk_children is cast to a list to ensure that it doesn't get consumed (as of the time of commit, it's still qan iterable). Once https://github.com/Textualize/textual/pull/952 has been accepted I'll change this (remove the cast).
Textual
Textual is a Python framework for creating interactive applications that run in your terminal.
🎬 Code browser
This is the code_browser.py example which clocks in at 61 lines (including docstrings and blank lines).
https://user-images.githubusercontent.com/554369/196156524-5edea78c-1226-4103-91f3-e82d6a52bd2b.mov
About
Textual adds interactivity to Rich with a Python API inspired by modern web development.
On modern terminal software (installed by default on most systems), Textual apps can use 16.7 million colors with mouse support and smooth flicker-free animation. A powerful layout engine and re-usable components makes it possible to build apps that rival the desktop and web experience.
Compatibility
Textual runs on Linux, macOS, and Windows. Textual requires Python 3.7 or above.
Installing
Install Textual via pip:
pip install textual[dev]
The addition of [dev] installs Textual development tools.
Reference commands
The textual command has a few sub-commands to preview Textual styles.
🎬 Easing reference
This is the easing reference which demonstrates the easing parameter on animation, with both movement and opacity. You can run it with the following command:
textual easing
https://user-images.githubusercontent.com/554369/196157100-352852a6-2b09-4dc8-a888-55b53570aff9.mov
🎬 Borders reference
This is the borders reference which demonstrates some of the borders styles in Textual. You can run it with the following command:
textual borders
https://user-images.githubusercontent.com/554369/196158235-4b45fb78-053d-4fd5-b285-e09b4f1c67a8.mov
Examples
The Textual repository comes with a number of examples you can experiment with or use as a template for your own projects.
