Search code examples
pythontkintercolorsscrollbartkinter-scrolledtext

How ro change a Tkinter ScrolledText widget's Scrollbar color?


I'm using the module ScrolledText in a Tkinter GUI.

I wish to change the colour of the Scrollbar encompassed in the ScrolledText widget, but I'm having some difficulty.

My syntax is correct (according to documentation).

Box = ScrolledText(root)
Box.vbar.config(troughcolor = 'red', bg = 'blue')
Box.pack()

However, the scrollbar still has the standard grey colour.

I know the syntax is correct, because doing other things such as:

 Box.vbar.config(cursor = 'target')   

...works exactly as it should.

However, attempting to change the relief, borderwidth or colors don't seem to have any effect.
Why is this happening?


Specs:

Python 2.7.1
Tkinter
Windows 7
IDLE


Solution

  • The Tk Scrollbar widget (vbar) is a native scrollbar in Windows. Its appearance depends on the Windows theme. Consider switching toolkits if it matters; I know PyQt4 will let you style the scrollbar on Windows.