-4
I wanted that when I pressed the button it started and when I arrived at the end disappeared, but neither the bar nor the button appear in the window created, it does not trigger an error on the screen.?
Here’s the code I’m using:
from tkinter import ttk
class SampleApp(tk.Tk):
def _init_(self,*args, **kwargs):
tk.Tk._(self,*args, **kwargs)
self.button = ttk.Button(text = 'play', command = self.start)
self.button.pack()
self.progress = ttk.Progressbar(self, orient = "horizontal", length = 200, mode = "determinate")
self.progress.place(x = 0, y = 10)
self.bytes = 0
self.maxbytes = 0
def start(self):
self.progress['values'] = 0
self.maxbytes = 50000
self.progress['maximun'] = 50000
self.read_bytes()
def read_bytes (self):
self.bytes += 500
self.progress['values'] = self.bytes
if self.bytes < self.maxbytes:
self.after(100, self.read_bytes)
app = SampleApp()
app.mainloop()
Thanks! It worked.
– L.Gabriel
and how do I stop when the progressibar arrives at the end the program execute an action?
– L.Gabriel
Then you’ll have to create your own code to check the progress of the progressbar and do something.
– JeanExtreme002