I have a simple TK gui and a long process in a function attached to a button and I want a progress bar when I click on the button. I want a progress bar went i click on the button, just like it start a long proc with many, many code line
how can i do that? here the code:
from tkinter import Button, Tk, HORIZONTAL
from tkinter.ttk import Progressbar
import time
class MonApp(Tk):
def __init__(self):
super().__init__()
bt1 = Button(self, text='Traitement', command=self.traitement)
bt1.grid()
self.progress = Progressbar(self, orient=HORIZONTAL,length=100, mode='indeterminate')
self.progress.grid()
self.progress.grid_forget()
def traitement(self):
self.progress.grid()
self.progress.start()
time.sleep(15)
## Just like you have many, many code lines...
self.progress.stop()
if __name__ == '__main__':
app = MonApp()
app.mainloop()
I have tried many things, but I don't haven't found how to.
How can I put a progress bar in that app?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…