Apr-08-2019, 08:22 PM
(Apr-08-2019, 06:10 PM)Larz60+ Wrote: All of the tools needed have been pointed out to you. You need to make an attempt to write the progress bar code. When you run into trouble, show us where you are having an issue, and we will be glad to help.
class ProgressBar: def __init__(self): self.root = tk.Tk() self.root.geometry('540x540') self.root.title(' PROGRAMA PRINCIPAL') self.step = tk.DoubleVar() self.progbar1 = ttk.Progressbar self.progbar2 = ttk.Progressbar self.progbar3 = ttk.Progressbar self.frame = tk.Frame() self.frame.grid() imagetest = PhotoImage(file="word.png") button_qwer = tk.Button(image = imagetest, command=self.start_progbar1) button_qwer.grid(row=1, column=2) imagetest1 = PhotoImage(file="powerpoint.png") button_qwer = tk.Button(image = imagetest1, command=self.start_progbar2) button_qwer.grid(row=1, column=3) imagetest2 = PhotoImage(file="excel.png") button_qwer = tk.Button(image = imagetest2, command=self.start_progbar3) button_qwer.grid(row=1, column=4) self.root.mainloop() def start_progbar1(self): self.progbar1 = ttk.Progressbar(orient=tk.HORIZONTAL, mode='determinate', variable=self.step) self.progbar1.grid(columnspan=3) for x in range(1,120): self.step.set(x) time.sleep(0.1) self.root.update() self.progbar1.destroy() if True: word() def start_progbar2(self): self.progbar2 = ttk.Progressbar(orient=tk.HORIZONTAL, mode='determinate', variable=self.step) self.progbar2.grid(columnspan=3) for x in range(1,120): self.step.set(x) time.sleep(0.1) self.root.update() self.progbar2.destroy() if True: powerpoint() def start_progbar3(self): if True: self.progbar3 = ttk.Progressbar(orient=tk.HORIZONTAL, mode='determinate', variable=self.step) self.progbar3.grid(columnspan=3) for x in range(1,120): self.step.set(x) time.sleep(0.1) self.root.update() self.progbar3.destroy() if True: excel() def word(): path = "C:/Program Files (x86)/Microsoft Office/root/Office16/" os.chdir(path) subprocess.run(["WINWORD.exe"]) def powerpoint(): path = "C:/Program Files (x86)/Microsoft Office/root/Office16/" os.chdir(path) subprocess.run(["POWERPNT.exe"]) def excel(): path = "C:/Program Files (x86)/Microsoft Office/root/Office16/" os.chdir(path) subprocess.run(["EXCEL.exe"]) if __name__ == '__main__': ProgressBar()I have done what you ask, it is working, but the problem i have is i can't place the "loading bar" anywhere else, i tried all the codes, but the ones that allow me to place the bar in the bottom, makes my buttons move to the right when the "loading bar appears" and if i don't use "self.progbar.destroy()",, when i pressed another button, a second, a third bar appears and so on (all of them loading).
Resuming:
move the loading bar to the bottom - without moving the buttons
don't allow another bars to popup, just the same - keep the bar visible at all times
Can you provide assistance for this?