Hiding a progressbar in tkinter

Cecil Westerhof Cecil at decebal.nl
Wed Jun 26 11:47:39 EDT 2019


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.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list