osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hiding a progressbar in tkinter


On Wed, 26 Jun 2019 17:47:39 +0200, Cecil Westerhof wrote:

> I just started with GUI stuff in tkinter. I have a progressbar, but I
> want it to be only visible when it is used. So I tried the following:
>     window = Tk()
>     window.title(window_str)
>     frame  = Frame(window)
>     frame.pack(side = "top", fill = "both", expand = True)
>     Button(window, text = button_str, command = select_dir).pack()
>     progress = ttk.Progressbar(window, orient = "horizontal", length = 200,
>                                mode = "determinate")
>     progress.pack()
>     progress.lower(frame)
>     window.mainloop()
> 
> But that does not hide the progressbar. What am I doing wrong?
> 
> I could use pack_forget, but that will change the dimensions of the
> window.

Here is an example using grid_forget().

https://stackoverflow.com/questions/33768577/tkinter-gui-with-progress-bar

Disclaimer:  I have not tested this code and cannot say for certain
that it will work the way you want.

-- 
<Wildman> GNU/Linux user #557453
"Be vewy vewy qwiwet, I'm hunting wabbits."
  -Elmer Fudd