I have created a progress bar with Tkinter :
self.progressbar = ttk.Progressbar(self, orient="horizontal", length=300, maximum=100, mode="determinate")
self.progressbar.place(x=250, y=225)
And i start it when i push a Button :
self.progressbar.start(10)
But i would like that it stop itself at the end of the progress bar and then doing something else (in my case open a text file) like that :
def LaunchButton()
self.progressbar.start(10)
if end of progress bar
self.progressbar.stop()
open text file
Thanks for helping !
Edit for @Saad :
My Launch button function :
def launchCallBack(self):
self.dataName = self.EditText.get("1.0", 'end-1c')
self.dataPath = self.PathText.get(ACTIVE)
self.dataDirectory = self.Directory.get(ACTIVE)
print(self.dataDirectory)
if self.dataPath == '' :
messagebox.showinfo("error", "Please select a XML (.aird) File before launching !")
elif '.' in self.dataName :
messagebox.showinfo("error", "You don't have to put extension (.ctm), just put the name of your file !")
elif self.dataName == '' :
messagebox.showinfo("error", "Please name your Text (.ctm) File before launching")
elif self.dataDirectory == '' :
messagebox.showinfo("error", "Please select a directory to put your Text (.ctm) File in !")
else :
self.textFileCreation()
The function textFileCreation is your update function :
def textFileCreation(self):
self.process += 10
self.progressbar['value'] = self.process
if self.progressbar['value'] >= self.progressbar['maximum']:
msg_succes = str("The file " + self.dataName + ".ctm has been created in the folder : " + self.dataDirectory)
messagebox.showinfo("success", msg_succes)
create_file(self.dataPath, self.dataName, self.dataDirectory)
return
else :
self.after(100, self.textFileCreation())