Does anyone know how I can change the color of my ttk.progressBar? It now shows a green color, and I would love to have it blue.
import ttk
self.progressBar = ttk.Progressbar(frame3, length=560, maximum=100, mode='determinate');
self.progressBar.place(x=-5, y=60)
The
Progressbar
appears to take a style argument. According to the documentation, a style can be used to set the foreground and background colours.Note: I haven't tried it myself, just pointing you to the relevant docs
I find out that for me it wont work, I don't want to say this is wrong however I have found use [ troughcolor ] to change background and [ background ] for indicator bar
not working for me
s.configure("red.Horizontal.TProgressbar", foreground='red', background='red')
my working way
s.configure("red.Horizontal.TProgressbar", troughcolor ='gray', background='red')
you can change the color of a progressbar, but it is tricky. First, you need to understand that if you use the default theme, which is the default theme if you do not specify a theme in the tk.style. Then it will pass all the information it needs to the operating system, which will do the drawing using its style, disregarding style info you passed it. meaning it will draw a Window's style green progressbar on Windows and so on and so forth. What you need to do is change the theme to a custom one that ttk draws. Try the "clam" style, it is one of the best looking styles that ttk allows you to chose from. here is a working adapted excerpt from a script I wrote:
and here is a picture confirming it working