Question

I'm experimenting with Python 2.7's new Tkinter Tile support (ttk). Is there a way to make the ttk.Progressbar() control auto-resize in proportion to its parent container? In reading the documentation on this control, it appears that one must explicitly set this widget's height or width?

I'm looking for a way to place the ttk.Progressbar widget in a horizontally resizable Tkinter dialog and have this widget resize as a user resize's the parent dialog.

Is there a window or frame resize event that I can trap, a ttk.Progressbar setting I can .config(), or .pack() option I can use to achieve my goal?

Any suggestions appreciated.

Was it helpful?

Solution

Try using the fill option of pack (or grid) to have the widget fill its container.

import Tkinter as tk
import ttk

root=tk.Tk()
pb = ttk.Progressbar(mode="indeterminate")
pb.pack(side="bottom", fill="x")
pb.start()
root.wm_geometry("300x300")
root.mainloop()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top