ragardner / tksheet

Python tkinter table widget for displaying tabular data
https://pypi.org/project/tksheet/
MIT License
408 stars 50 forks source link

ScrollBar BackGround #243

Open FolkJet opened 3 months ago

FolkJet commented 3 months ago

How can I change the background color of the scroll bar?

I wanted to change the color to red, for example.

I've attached the code and the image to make it easier.

I tried every way, but unfortunately I couldn't.

Sorry for the English, I'm using Google Translate

white

ragardner commented 3 months ago

Hello, I think there may be some issues changing the color on windows, I will let you know if I find a work around

FolkJet commented 3 months ago

Thank you very much.

ragardner commented 3 months ago

Hello, after a little testing and research I am unable to change the scroll bar colours on windows :(

JonnyNOS commented 1 month ago

i have done it some months ago i think i just swapped the scrollbar for a CTkScrollbar and specified a bg color for it

like here in lines 349 - 357 in the sheet.py:

if ctk.get_appearance_mode() == "Dark": # <-- line inserted
            bg_color = "#363636"        # <-- line inserted
        else:                           # <-- line inserted
            bg_color = "#d6d6d6"        # <-- line inserted
        self.yscroll = ctk.CTkScrollbar(self, command=self.MT.set_yviews, orientation="vertical", fg_color=bg_color) # <-- changed
        self.xscroll = ctk.CTkScrollbar(self, command=self.MT.set_xviews, orientation="horizontal", fg_color=bg_color) # <-- changed
        if show_top_left:
            self.TL.grid(row=0, column=0)
        if show_table:

now the Scrollbar changes appearance according to the set up appearance-mode

let me know if that works for you.