mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
added auto height
This commit is contained in:
@@ -10,11 +10,10 @@ Widget {
|
||||
}
|
||||
|
||||
#thing {
|
||||
|
||||
width: auto;
|
||||
height: 10;
|
||||
height: auto;
|
||||
background:magenta;
|
||||
margin: 3;
|
||||
margin: 1;
|
||||
padding: 1;
|
||||
border: solid white;
|
||||
box-sizing: border-box;
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
from rich.text import Text
|
||||
|
||||
from textual.app import App
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widget import Widget
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class Thing(Widget):
|
||||
def render(self):
|
||||
return Text.from_markup("Hello, World. [b magenta]Lorem impsum.")
|
||||
return "Hello, 3434 World.\n[b]Lorem impsum."
|
||||
|
||||
|
||||
class AlignApp(App):
|
||||
def on_load(self):
|
||||
self.bind("t", "log_tree")
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.log("MOUNTED")
|
||||
self.mount(thing=Thing(), thing2=Static("0123456789"), thing3=Widget())
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Thing(id="thing")
|
||||
yield Static("foo", id="thing2")
|
||||
yield Widget(id="thing3")
|
||||
|
||||
def action_log_tree(self):
|
||||
self.log(self.screen.tree)
|
||||
|
||||
|
||||
AlignApp.run(css_path="align.css", log_path="textual.log", watch_css=True)
|
||||
app = AlignApp(css_path="align.css")
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
|
||||
@@ -76,7 +76,9 @@ class BasicApp(App):
|
||||
self.focused.styles.border_top = ("solid", "invalid-color")
|
||||
|
||||
|
||||
app = BasicApp(css_path="uber.css", log_path="textual.log", log_verbosity=1)
|
||||
app = BasicApp(
|
||||
css_path="uber.css",
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
|
||||
Reference in New Issue
Block a user