Python Forum

Full Version: tkinter progress bar for decending number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone, I'm starting an app to track weight loss and other goals. I was wondering if there is a way for the tkinter progress bar to go up when the number is going down? Like the goal weight will be set and as you lose weight the progress bar will fill till you reach your goal.I would have a current weight var and goal var. is there an option for that on tkinter or do I have to figure out some kind of math trickery lol don't really have any code to post yet, just wondering how I would go about it. I'm new so please be patient with me :)
>>> starting_weight = 225
>>> def get_progress_value(current_weight):
...     return starting_weight - current_weight
>>> for current_weight in range(225, 217, -1):
...     print(f"Current weight: {current_weight}, Progress bar value: {get_progress_value(current_weight)}")
Current weight: 225, Progress bar value: 0
Current weight: 224, Progress bar value: 1
Current weight: 223, Progress bar value: 2
Current weight: 222, Progress bar value: 3
Current weight: 221, Progress bar value: 4
Current weight: 220, Progress bar value: 5
Current weight: 219, Progress bar value: 6
Current weight: 218, Progress bar value: 7