Forum Discussion
Altera_Forum
Honored Contributor
11 years agoThe solution is so simple that I am almost ashamed to post it. You don't have to delete anything if you dont print anything, so for a very simple progress bar it is enough to print a character on the right iterations.
Here is the code:
set BAR_LEN 50
# ##############################################################################
# Puts top line
proc put_top_line { } {
global BAR_LEN
puts -nonewline "|"
for {set i 0} {$i < $BAR_LEN} {incr i} {
puts -nonewline "-"
}
puts -nonewline "|\n"
}
# ##############################################################################
# Puts# to fill the progress bar, should be called every loop iteration
proc put_filler {cur max} {
global BAR_LEN
if { } {
puts -nonewline "|"
} elseif { } {
puts -nonewline "|\n"
} else {
set curValue
set nextValue
if { } {
puts -nonewline "#"
}
}
}
# ##############################################################################
# Test
put_top_line
for {set i 0} { $i < 1000 } { incr i } {
put_filler $i 999
after 10
}