Posted to tcl by Machtyn at Mon Nov 05 22:13:33 GMT 2007view raw

  1. proc temp {} {
  2. ## Initialize the progress bar
  3. toplevel .prg
  4. wm title .prg "Copying Files"
  5. frame .prg.from
  6. label .prg.from.lbl -text "From: "
  7. label .prg.from.var -textvariable statusFrom
  8. pack .prg.from.lbl .prg.from.var -side left
  9. frame .prg.to
  10. label .prg.to.lbl -text "To: "
  11. label .prg.to.var -textvariable statusTo
  12. pack .prg.to.lbl .prg.to.var -side left
  13. set prg 0
  14. ProgressBar .prg.pb -width 400 -height 20 -variable copyProgress
  15. pack .prg.from .prg.to .prg.pb -side top -pady 5
  16.  
  17. update idletasks
  18.  
  19. foreach ch [winfo children .components.chkbtns] {
  20. $ch toggle
  21. update idletasks
  22. after 500
  23. }
  24.  
  25. wm title .prg "Finished Copy"
  26. foreach w [winfo children .prg] { destroy $w }
  27. label .prg.lbl -text "Finished copying files."
  28. set copyProgress 1
  29. ProgressBar .prg.pb -width 400 -height 20 -variable copyProgress -maximum 1
  30. button .prg.btn -text "OK" -command "destroy .prg"
  31. pack .prg.lbl .prg.pb .prg.btn -side top -pady 5
  32. update idletasks
  33. }

Comments

Posted by machtyn at Mon Nov 05 22:29:47 GMT 2007 [text] [code]

Line 13. change to "set copyProgress 0" Line 14. add "-maximum [llength [winfo children .components.chkbtns]]" Line 20.5. insert "incr copyProgress"