Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

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

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. 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!
    
  5. foundin changed to: "8.6.9"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "e7e81e71688f47fe98b094316d502a5ce4f884ed"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "18. Commands M-Z"
  15. title changed to:
    ProgressbarStepCommand sets value to 0 when reaching maximum
    
  16. type changed to: "Bug"