Replies: 2 comments
-
We found the following entries in the FAQ which you may find helpful: Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review. This project is developed and maintained by Will McGugan. Consider sponsoring Will's work on this project (and others). This is an automated reply, generated by FAQtory |
Beta Was this translation helpful? Give feedback.
-
Almost 8,000 repos depending on Textual here on GitHub alone, 30,000 stars and counting, hardly a day goes by where I don't see some project mentioned somewhere on the net that isn't built with Python+Textual. It's gonna be crazy once Textual isn't held back any more!
I've seen plenty of Textual applications that have a REPL-a-like interface and they don't need hundreds of lines of code to do it. Let's take your input/print example. Here's my quick and simple Textual take on that: from textual import on
from textual.app import App, ComposeResult
from textual.widgets import Input, OptionList
class SimpleREPLApp(App[None]):
AUTO_FOCUS = "Input"
CSS = """
OptionList {
padding: 0;
border: none;
height: 1fr;
}
Input {
border: none;
padding: 0;
height: 1;
}
"""
def compose(self) -> ComposeResult:
yield OptionList()
yield Input()
@on(Input.Submitted)
def _user_input(self, message: Input.Submitted) -> None:
self.query_one(OptionList).add_option(message.value)
self.query_one(Input).value = ""
if __name__ == "__main__":
SimpleREPLApp().run() Nowhere near 100s of lines, and most of the lines are CSS to style it "just so". |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
One of the most important things holding textual back right now is the ability to do python logic inside a widget.
For example, I want to make a repl in textual. As far as I know this is completely impossible without hundreds of lines of code. Where as in plain python you can do this
It would be nice to then just take that while loop and just have a widget that can run that code. Like a container widget that just keeps that output prompt inside of the widget. For example:
This would make it so much easier to write things like REPLs and things that have to respond to user input.
Beta Was this translation helpful? Give feedback.
All reactions