I have a python script with a bunch of 'for' loops (with different iterations). I want to implement a progress bar for each of these loops so that for each iteration in these loops the bar is updated. I know how to implement a progress bar, but writing a progress bar for each loop will take time, not to mention I will be adding more such loops later.
The idea in my head right now is this: I want to know whether it is possible to 'do some task' whenever the program starts iterating through a for loop? Basically:
[some previous task] --> (for loop) --> (print("for loop initiated!")/ do something) --> <start iteration through for loop> --> <reached end of for loop> --> (print("done!")/do something else) --> [next task on script]
In summary, I want to write a function/method in the script such that it notifies itself whenever a for loop is initiated and runs a progress bar on its own.
Is there any way to do this? Or do you maybe have better ideas? And a side note here, if there are any alternative progress bar suggestions, they should be compatible with tkinter because I am also using that in the script.