Comments (9)
Hi @samuelcolvin Horizontal scrolling should be fixed in v0.1.11 (just released)
from textual.
Hi Samuel,
Thanks for the bug report. The horizontal scroll bar should show automatically if he renderable is wider than the widget size, but I can see from a quick test that it isn't. Will fix that in the next update.
from textual.
Thanks so much, not sure if it's part of the same problem, but horizontal scrolling didn't seem to be working at all - e.g. if I used the left and right arrows, no scrolling occurred.
from textual.
Yeah, they aren't showing anywhere. It was working at one point. But they haven't been as well tested as vertical scrollbars.
from textual.
thanks so much. I'll test now.
from textual.
Thanks so much, works brilliantly.
The only small problem I found was that by default I could scroll vertically with the arrow keys, but not horizontally.
I fixed that fairly easily as follows:
from rich.table import Table
from textual import events
from textual.app import App
from textual.widgets import ScrollView
class CustomScrollView(ScrollView):
def move_left(self) -> None:
self.target_x -= 2
self.animate("x", self.target_x, speed=80, easing="out_cubic")
def move_right(self) -> None:
self.target_x += 2
self.animate("x", self.target_x, speed=80, easing="out_cubic")
class MyApp(App):
"""An example of a very simple Textual App"""
async def on_load(self, event: events.Load) -> None:
await self.bind("q", "quit", "Quit")
def on_key(self, event: events.Key):
if event.key == 'left':
self.body.move_left()
elif event.key == 'right':
self.body.move_right()
async def on_mount(self, event: events.Mount) -> None:
self.body = body = CustomScrollView(auto_width=True)
await self.view.dock(body)
async def add_content():
table = Table(title="Demo")
for i in range(40):
table.add_column(f"Col {i + 1}", style="magenta")
for i in range(200):
table.add_row(*[f"cell {i},{j}" for j in range(40)])
await body.update(table)
await self.call_later(add_content)
self.log('HELLO')
MyApp.run(title="Simple App", log="textual.log")
Happy to add that to the example if you don't think it should work out of the box?
from textual.
the other thing I noticed is that rendering the table is relatively slow, even for this modest table. Any idea what's causing that slow down and if it can be solved?
I'm thinking of a tool that can easily show a table thousands of rows a hundred columns, if I extrapolated the current performance to that it would get very slow to load.
from textual.
The scroll view widget should probably handle the left/right keys. I'll add that in the next update.
Large tables will be slow to render in a ScrollView, since it renders everything up front. There will eventually be a datatable widget that is optimized to only render the visible area.
from textual.
Did I solve your problem?
Consider sponsoring my work on Textual with a monthly donation.
Or buy me a coffee to say thanks.
from textual.
Related Issues (20)
- Allow TextArea API edits to defer batching HOT 3
- Wrap overloads with `if TYPE_CHECKING` HOT 2
- textual-web embedded demos in the docs don't appear to work
- All TextAreas have blinking cursors after switching back to a previously selected tab HOT 2
- Allow `Signal.publish` to include some data HOT 1
- Using Textualize for a tutorial? HOT 1
- Width of Static is miscalulated when markup is used HOT 10
- Resizing problems when importing `readline` HOT 1
- `ListView` initial index is off by one HOT 3
- Colour background of widget not rendering correctly HOT 1
- Upcoming deprecation (+ breakage in your case) regarding custom templates for mkdocstrings HOT 6
- Improve the `ListView` documentation by explaining the `ListItem` HOT 3
- Mounting of `Markdown` isn't reliably awaitable HOT 3
- Make `cursor_location` a reactive attribute HOT 4
- Unfocusing and refocusing the terminal has undesirable scrolling behaviour HOT 2
- Giving focus to a widget not scrolled into view doesn't always scroll it into view HOT 6
- SelectionList weird behavior when removing options in its own event handler until freeze HOT 2
- Strange column width behaviour when updating `DataTable` on `*Selected` event HOT 3
- Add information about ToastRack styling to the toast widget documentation HOT 2
- False Information: Mayday Release HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.