question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Horizontal scrolling

See original GitHub issue

(hope you don’t mind me opening an issue to ask a question, I’ve tried hard to get to the bottom of this myself)

I’m trying to get horizontal scrolling working with textual and a rich table, but no luck

Below is what I have so far.

It seems like the table is refusing to exceed the width of the terminal, thus the horizontal scroll bar of ScrollView is not coming into play.

Vertical scrolling is working great.

What am I doing wrong?

(ref: https://twitter.com/samuel_colvin/status/1426289617632960515)

from rich.table import Table

from textual import events
from textual.app import App
from textual.widgets import Header, Footer, ScrollView


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")

    async def on_mount(self, event: events.Mount) -> None:

        self.body = body = ScrollView()
        body.virtual_size.width = 300

        await self.view.dock(body)

        async def add_content():
            table = Table(title="Demo", width=300, min_width=300)

            for i in range(40):
                table.add_column(f'Col {i + 1}', style='magenta')

            for i in range(40):
                table.add_row(*[f'cell {i},{j}' for j in range(40)])

            await body.update(table)

        await self.call_later(add_content)


MyApp.run(title="Simple App", log="textual.log")

Versions:

python 3.9.5
textual==0.1.10
rich==10.7.0
OS: Ubuntu 21.04 with standard terminal

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Sep 12, 2021

Hi @samuelcolvin Horizontal scrolling should be fixed in v0.1.11 (just released)

0reactions
github-actions[bot]commented, Sep 14, 2021

Did I solve your problem?

Consider sponsoring my work on Textual with a monthly donation.

Or buy me a coffee to say thanks.

Will McGugan

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create a Horizontal Scrolling Menu - W3Schools
How To Create a Horizontal Scrollable Menu. Step 1) Add HTML: Example. <div class="scrollmenu">
Read more >
How To Create Horizontal Scrolling Containers - codeburst
Let's first create our container and our children divs inside of it that will scroll horizontally. The HTML is pretty simple. <div class="scrolling-wrapper">...
Read more >
17 Stunning Horizontal Scrolling Websites - Qode Interactive
Horizontal scrolling is an effect that has the power to make browsing more engrossing and enjoyable. What matters is to plan it well,...
Read more >
Pure CSS Horizontal Scrolling - CSS-Tricks
As a user, if you want to natively scroll horizontally on a non-touch device, you can hold Shift while rolling the scroll wheel....
Read more >
Advanced interactions: Horizontal scroll in Webflow - YouTube
As previously seen on Apple's iPad page, horizontal scrolling fully engages visitors by using a unique interaction that changes their ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found