Search code examples
pythontkinterttk

Tkinter ttk.Progressbar: How to change the graphical length/width of the progress bar?


So I was messing around with the progressbar in ttk, but I was wondering how to change its length. Not like the numerical value of its length, but the actual visual length of the progressbar.

With other widgets, I would just to 'width=27' or whatever and change it that way, but it doesn't seem to work.

Any ideas? Thank you.


Solution

  • To sum up from the comments:

    • ttk.Progressbar does not have a width option unlike most widgets, but it has a length option.

    • Do not confuse length as the maximum value of the progressbar, it is just the width of the progressbar(by default in pixels).

    • The maximum value of progressbar can be set using the maximum option.

    • To get a list of properties a widget accepts you can use <Widget>().keys() or if you want a detailed look ~ <Widget>.__init__.__docs__ will return the docstring of widget's __init__(as TheLizzard said).

    ttk.Progressbar(root, length=200, maximum=300) # 200 pixels wide and 300 is maximum value