mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
committed by
GitHub
parent
ae2a155347
commit
38592c34bd
@@ -5,13 +5,13 @@ Your questions should go in this directory.
|
||||
|
||||
Question files should be named with the extension ".question.md".
|
||||
|
||||
To build the faq, install [faqtory](https://github.com/willmcgugan/faqtory) if you haven't already:
|
||||
To build the FAQ, install [faqtory](https://github.com/willmcgugan/faqtory) if you haven't already:
|
||||
|
||||
```
|
||||
pip install faqtory
|
||||
```
|
||||
|
||||
The run the following from the top of the repository:
|
||||
Then run the following from the top of the repository:
|
||||
|
||||
```
|
||||
faqtory build
|
||||
|
||||
45
questions/datatable-doesnt-scroll.question.md
Normal file
45
questions/datatable-doesnt-scroll.question.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: "Why doesn't the `DataTable` scroll programmatically?"
|
||||
alt_titles:
|
||||
- "Scroll bindings from `DataTable` not working."
|
||||
- "Datatable cursor goes off screen and doesn't scroll."
|
||||
---
|
||||
|
||||
If it looks like the scrolling in your `DataTable` is broken, it may be because your `DataTable` does not have its height set, which means it is using the default value of `height: auto`.
|
||||
In turn, this means that the `DataTable` itself does not have a scrollbar and, hence, it cannot scroll.
|
||||
|
||||
If it looks like your `DataTable` has scrollbars, those might belong to the container(s) of the `DataTable`, which in turn makes it look like the scrolling of the `DataTable` is broken.
|
||||
|
||||
To see the difference, try running the app below with and without the comment in the attribute `TableApp.CSS`.
|
||||
Press <kbd>E</kbd> to scroll the `DataTable` to the end.
|
||||
If the `CSS` is commented out, the `DataTable` does not have a scrollbar and, therefore, there is nothing to scroll.
|
||||
|
||||
<details>
|
||||
<summary>Example app.</summary>
|
||||
|
||||
```py
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import DataTable
|
||||
|
||||
|
||||
class TableApp(App):
|
||||
# CSS = "DataTable { height: 100% }"
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield DataTable()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
table = self.query_one(DataTable)
|
||||
table.add_column("n")
|
||||
table.add_rows([(n,) for n in range(300)])
|
||||
|
||||
def key_e(self) -> None:
|
||||
self.query_one(DataTable).action_scroll_end()
|
||||
|
||||
|
||||
app = TableApp()
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -3,9 +3,8 @@ title: "Does Textual support images?"
|
||||
alt_titles:
|
||||
- "Can Textual display PNG / SVG files?"
|
||||
- "Render images"
|
||||
|
||||
---
|
||||
|
||||
Textual doesn't have built in support for images yet, but it is on the [Roadmap](https://textual.textualize.io/roadmap/).
|
||||
Textual doesn't have built-in support for images yet, but it is on the [Roadmap](https://textual.textualize.io/roadmap/).
|
||||
|
||||
See also the [rich-pixels](https://github.com/darrenburns/rich-pixels) project for a Rich renderable for images that works with Textual.
|
||||
|
||||
Reference in New Issue
Block a user