Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to customise scrollbar bar segments #4500

Closed
mon opened this issue May 10, 2024 · 8 comments · Fixed by #4505
Closed

Add the ability to customise scrollbar bar segments #4500

mon opened this issue May 10, 2024 · 8 comments · Fixed by #4505

Comments

@mon
Copy link
Contributor

mon commented May 10, 2024

Currently, the characters that make up a scrollbar are hardcoded. It would be nice if they could be overridden. Personally, I need to support poor fonts, so need to replace missing glyphs. But it would be neat to use braille characters for a unique style.

Thoughts on making them a classvar, so they can be monkeypatched in for now? I can do that PR if it's an OK change.

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

You can patch in a new scrollbar renderable as follow:

from textual.scrollbar import Scrollbar

ScrollBar.renderer = MyScrollbarRenderer

Have a look at how the original is implemented. You can copy that and customize it.

@mon
Copy link
Contributor Author

mon commented May 10, 2024

For sure! I was just hoping for an easier way than duplicating the ~72 line render function. Textual is still developing pretty quickly, and I'm wary vendoring too much of its code to fix things.

@davep
Copy link
Contributor

davep commented May 10, 2024

@mon For what it's worth, the scrollbar renderer has been in place for well over a year, has been stable as far as I can remember, and is part of the documented API.

@willmcgugan
Copy link
Collaborator

Yeah, that's not going to change. Textual's API is quite stable now.

@mon
Copy link
Contributor Author

mon commented May 11, 2024

That's good to know! I guess then - would a PR changing the bar glyphs to be a classvar be rejected? I still do like the idea of a 3-line way to modify the class.

@willmcgugan
Copy link
Collaborator

I think that would be reasonable. Happy to accept a PR.

Copy link

github-actions bot commented Jun 2, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants