GithubHelp home page GithubHelp logo

Comments (2)

ragardner avatar ragardner commented on June 12, 2024

Thanks for your question and sorry for the late reply,

I think I have found a way to do this, the test code I have been using sits inside sheet.py __init__ function:

style = ttk.Style()
for orientation in ("Vertical", "Horizontal"):
    style.element_create(f"Tksheet.{orientation}.TScrollbar.trough", "from", "default")
    style.element_create(f"Tksheet.{orientation}.TScrollbar.thumb", "from", "default")
    style.element_create(f"Tksheet.{orientation}.TScrollbar.grip", "from", "default")
    
    # in case you want to remove the arrow buttons uncomment below:
    
    # style.layout(
    #     f"Tksheet.{orientation}.TScrollbar",
    #     [
    #         (
    #             f"Tksheet.{orientation}.TScrollbar.trough",
    #             {
    #                 "children": [
    #                     (
    #                         f"Tksheet.{orientation}.TScrollbar.thumb",
    #                         {
    #                             "unit": "1",
    #                             "children": [(f"Tksheet.{orientation}.TScrollbar.grip", {"sticky": ""})],
    #                             "sticky": "nswe",
    #                         },
    #                     )
    #                 ],
    #                 "sticky": "ns" if orientation == "Vertical" else "ew",
    #             },
    #         )
    #     ],
    # )
    style.configure(
        f"Tksheet.{orientation}.TScrollbar",
        gripcount=0,
        borderwidth=2,
        background="#b0b0b0",
        troughcolor="red",
        bordercolor="#252526",
        lightcolor="#252526",
        darkcolor="#252526",
    )

Those colours are just to test it out

I will hopefully be adding the Sheet initialization and set_options() parameters for scrollbar colours in the next update

Edit: I forgot to mention you also have to set the style parameter for the scrollbars if using the above code

self.yscroll = ttk.Scrollbar(
    self,
    command=self.MT.set_yviews,
    orient="vertical",
    style="Tksheet.Vertical.TScrollbar",
)
self.xscroll = ttk.Scrollbar(
    self,
    command=self.MT.set_xviews,
    orient="horizontal",
    style="Tksheet.Horizontal.TScrollbar",
)

Edit 2: You also have to use the style.map() function it seems, something like shown in this stackoverflow answer

Edit 3: This seems to clash with the dropdown boxes scrollbars and cause an error

from tksheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.