Merge pull request #819 from Textualize/docs-widgets

Document widgets
This commit is contained in:
Will McGugan
2022-10-05 09:27:00 +01:00
committed by GitHub
26 changed files with 265 additions and 39 deletions

View File

@@ -11,7 +11,7 @@ from textual.app import App
from textual.geometry import Size
from textual.reactive import Reactive
from textual.widget import Widget
from textual.widgets.text_input import TextInput, TextWidgetBase
from textual.widgets._input import Input
def get_files() -> list[Path]:
@@ -53,12 +53,12 @@ class FileSearchApp(App):
def on_mount(self) -> None:
self.file_table = FileTable(id="file_table", files=list(Path.cwd().iterdir()))
self.search_bar = TextInput(placeholder="Search for files...")
self.search_bar.focus()
self.mount(file_table_wrapper=Widget(self.file_table))
self.search_bar = Input(placeholder="Search for files...")
# self.search_bar.focus()
self.mount(search_bar=self.search_bar)
self.mount(file_table_wrapper=Widget(self.file_table))
def on_text_input_changed(self, event: TextInput.Changed) -> None:
def on_input_changed(self, event: Input.Changed) -> None:
self.file_table.filter = event.value

View File

@@ -1,12 +1,8 @@
Screen {
}
#file_table_wrapper {
dock: bottom;
height: auto;
overflow: auto auto;
scrollbar-color: $accent-darken-1;
}
@@ -15,7 +11,5 @@ Screen {
}
#search_bar {
dock: bottom;
background: $accent;
height: 1;
}