Feature Suggestions #3
Replies: 13 comments 29 replies
-
I'd love to see trio support |
Beta Was this translation helpful? Give feedback.
-
Have you considered an API similar to FastAPI or flask? I understand that those are web servers, but an API like that may fit this project. For example, a refractor of examples/simple.py: from rich.markdown import Markdown
from textual import events
from textual.app import Textual
from textual.widgets.header import Header
from textual.widgets.placeholder import Placeholder
from textual.widgets.window import Window
with open("richreadme.md", "rt") as fh:
readme = Markdown(fh.read(), hyperlinks=True, code_theme="fruity")
app = Textual()
app.bind({
"q": "quit",
"ctrl+c": "quit",
"b":"view.toggle('left')"
})
@app.on("startup")
async def on_startup(event: events.Startup) -> None:
await app.view.mount_all(
header=Header(app.title), left=Placeholder(), body=Window(readme)
)
app.run() This could also be implemented to work like so: from rich.markdown import Markdown
from textual import events
from textual.app import Textual
from textual.widgets.header import Header
from textual.widgets.placeholder import Placeholder
from textual.widgets.window import Window
with open("richreadme.md", "rt") as fh:
readme = Markdown(fh.read(), hyperlinks=True, code_theme="fruity")
class App(Textual):
def __init__(self):
self.bind({
"q": "quit",
"ctrl+c": "quit",
"b":"view.toggle('left')"
})
@on("startup")
async def on_startup(self, event: events.Startup) -> None:
await self.view.mount_all(
header=Header(self.title), left=Placeholder(), body=Window(readme)
)
app = App()
app.run() This would just help to make things less hard-coded and more dynamic. For example: if the user wanted to use I was also thinking maybe use a bind function instead of the KEYS variable that can also bind at runtime, in three variants: # Dictionary of key to event
app.bind({
"q": "quit",
"ctrl+c": "quit",
"b":"view.toggle('left')"
})
# List to events
app.bind(["q","ctrl+c"], "quit")
# Key to event
app.bind("b", "view.toggle('left')") This would make adding and removing keybinds at runtime much easier. (At least, that is what I feel) All in all, I am very excited to see this project, and wish you much luck and happy coding. 😃 |
Beta Was this translation helpful? Give feedback.
-
Would love to see a scrollable list view. But, to make it really awesome the implementation hopefully would be something like Rich tables. Along with that, a few thoughts:
|
Beta Was this translation helpful? Give feedback.
-
I'd love to see support for resourceful TUIs in ways similar to https://p403n1x87.github.io/the-austin-tui-way-to-resourceful-text-based-user-interfaces.html or https://github.com/salt-die/nurses so that I don't have to maintain my own framework. |
Beta Was this translation helpful? Give feedback.
-
I would love to see ready to use widgets, such as Menus, Forms (possibly with validation hooks), and popup dialogs. We've been using npyscreen as it has those features, but that package hasn't been updated in years and we're looking to move away from it. rich-tui is looking very promising! |
Beta Was this translation helpful? Give feedback.
-
Hi Will, I posted this as an Issue before I noticed this discussion… 😅 One widget I commonly use in many different contexts is some sort of tabbed container. I'm willing to open a PR for this myself, but I thought it might be nice to first discuss the API for it. I'd expect the following usage pattern: class MyApp(App):
async def on_mount(self, event: events.Mount) -> None:
tab1 = Tab("First Tab Label")
# ... add some widgets to tab1
await tab1.view.dock(someWidget())
await tab1.view.dock(someWidget())
await tab1.view.dock(someWidget())
tab2 = Tab("Second Tab Label")
# ... add some widgets to the tab
await tab2.view.dock(someWidget())
await tab2.view.dock(someWidget())
await tab2.view.dock(someWidget())
tabs = Tabs([tab1, tab2])
await self.view.dock(tabs) And I'd expect the output to look similar to this:
With the small difference of the selected being highlighted somehow, be it bold or underlined or italic or whatever. What are your thoughts on something like this? |
Beta Was this translation helpful? Give feedback.
-
@willmcgugan, |
Beta Was this translation helpful? Give feedback.
-
I'd like to see argument parsing including robust config file support. It will probably be one of the first things I do on my own assuming I move forward with using Textual for my project. I will try to do that in a way such that I can extract into a PR for Textual, but wouldn't want to duplicate effort if there are already plans to do this and/or explicitly wishes to keep that as something to be done outside of this framework. |
Beta Was this translation helpful? Give feedback.
-
Don't know if this as much feature, but as community grows around textual imagine many will create their own reusable widgets. With this wondering if there any community standards and such we want to set (even if simple things like repo naming conventions, etc) Thinking like what see from some community aspects like see in https://github.com/streamlit/streamlit where they have like streamlit gallery, component templates, streamlit repo readme badge. Another community additions to derive inspiration from is possibly pytest plugins |
Beta Was this translation helpful? Give feedback.
-
@willmcgugan,
|
Beta Was this translation helpful? Give feedback.
-
An image or thumbnail widget:
|
Beta Was this translation helpful? Give feedback.
-
An terminal prompt being automatically generated based on a JSON schema would be great! |
Beta Was this translation helpful? Give feedback.
-
a |
Beta Was this translation helpful? Give feedback.
-
If there is a feature you really want to see in Rich TUI, post it here!
Beta Was this translation helpful? Give feedback.
All reactions