mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Simple multiline text widget to help model text base class
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from textual.app import App
|
||||
from textual.widget import Widget
|
||||
|
||||
from textual.widgets.text_input import TextInput, TextInputBase
|
||||
from textual.widgets.text_input import TextInput, TextWidgetBase, TextArea
|
||||
|
||||
|
||||
def celsius_to_fahrenheit(celsius: float) -> float:
|
||||
@@ -19,8 +19,10 @@ class InputApp(App[str]):
|
||||
self.fahrenheit.focus()
|
||||
text_boxes = Widget(self.fahrenheit, self.celsius)
|
||||
self.mount(inputs=text_boxes)
|
||||
self.mount(spacer=Widget())
|
||||
self.mount(text_area=TextArea())
|
||||
|
||||
def handle_changed(self, event: TextInputBase.Changed) -> None:
|
||||
def handle_changed(self, event: TextWidgetBase.Changed) -> None:
|
||||
try:
|
||||
value = float(event.value)
|
||||
except ValueError:
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
|
||||
App {
|
||||
layout: dock;
|
||||
docks: top=top bot=bottom;
|
||||
background: $secondary;
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 1;
|
||||
background: $primary-darken-2;
|
||||
dock: top;
|
||||
}
|
||||
|
||||
Screen {
|
||||
layout: dock;
|
||||
docks: top=top bottom=bottom;
|
||||
background: $secondary;
|
||||
}
|
||||
|
||||
@@ -29,3 +35,7 @@ Screen {
|
||||
background: $secondary;
|
||||
height: 20;
|
||||
}
|
||||
|
||||
#text_area {
|
||||
dock: bottom;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user