D
D
Duckbill32132019-09-08 18:19:51
Python
Duckbill3213, 2019-09-08 18:19:51

tkinter loading indicator?

I have created a loading indicator in my tkinter window that just keeps
looping Is it possible to make a function run when a certain percentage is reached?
The code:

from tkinter import *
from tkinter import ttk
from tkinter import Toplevel 

root = Tk()
root.geometry('500x500')
root.title('Suck my dick')
pb = ttk.Progressbar(root,orient='horizontal',mode='determinate',length=200)
pb.pack()
pb.start()

root.mainloop()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1Bragim0ff, 2020-05-26
@1Bragim0ff

In this case, progress is not measured in percentage terms.
You can check the value of the progress bar using if.

if pb['value'] == 10:
   func()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question