Overview
| Artifact ID: | ef35d5cf5c60aa4324afdbe7498f583af721352fd5a53d7ffbeac2772f9c2f40 |
|---|---|
| Ticket: | 9ad28e91c089f89cb28999b08b66ec1e3726e71b
ProgressbarStepCommand sets value to 0 when reaching maximum |
| User & Date: | anonymous on 2019-01-17 15:51:32 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Summary: ProgressbarStepCommand’s behaviour differs from what is mentioned in its comments. If value reaches maximum exactly, the fmod() call resets it to 0. Details: I’m using Python’s tkinter, but could track down the bug I found to the Tcl/Tk source. My code iterates through a number of items; I set the progressbar maximum to that number and call the progressbar step command in each iteration to increase by 1. For example, with maximum = 42: after the first iteration, the value is 1.0, after the second it is 2.0 and so on until the second-to-last iteration, when it is 41.0. But on the last iteration, the value is reset to 0.0, resulting in an empty progress bar at the end of my computations. If I set value to maximum directly (without using successive calls to step), the progressbar is full, and when I read back the value it is equal to maximum. So code outside of ProgressbarStepCommand handles this case differently. The comment in ProgressbarStepCommand (file generic/ttk/ttkProgress.c) says: “In determinate mode, wrap around if value exceeds maximum”. Please note that wrap-around should occur when value *exceeds* maximum, which makes sense. The code however is: value = fmod(value, maximum) This already wraps around to 0.0 when value is *equal* to maximum. My suggestion: test for value > maximum, only then call fmod() Thanks!
- foundin changed to: "8.6.9"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "e7e81e71688f47fe98b094316d502a5ce4f884ed"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "18. Commands M-Z"
- title changed to:
ProgressbarStepCommand sets value to 0 when reaching maximum
- type changed to: "Bug"