For Programmers: Free Programming Magazines  


Home > Archive > Tcl > June 2005 > 2 proc in the same time -- don't want to run?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author 2 proc in the same time -- don't want to run?
nicolas

2005-06-08, 4:01 pm

hi all
i have 2 proc
first:

proc charge {sexs } {
for {set i 0} {$i < [expr ($sexs * 10)]} {incr i} {
runs $i $sexs
after 100
update
}
}


second:

proc chargep {sexp} {
for {set i 0} {$i < [expr ($sexp * 10)]} {incr i} {
runp $i $sexp
after 100
update
}
}

this is the run proc (runs and runp are almost the same
proc runs {percents tos} {
..h.s coords bars 0 0 [expr ($percents * (20 / $tos))] 20 }

charge* proc are binded with a button but they don't want to calcul in
the same time.
my goal is to have "like a progress bar " with rectangle canvas to
display a time evolution.

i have 2 canvas. they display different time progress...

but i don't succeed
the charges proc run and only after the chargep begin. or i would like
they act in the same time.

where do i make a mistake?
thanks for help
nicolas

Michael Schlenker

2005-06-08, 4:01 pm

nicolas wrote:
> hi all
> i have 2 proc
> first:
>
> proc charge {sexs } {
> for {set i 0} {$i < [expr ($sexs * 10)]} {incr i} {
> runs $i $sexs
> after 100
> update
> }
> }
>
>
> second:
>
> proc chargep {sexp} {
> for {set i 0} {$i < [expr ($sexp * 10)]} {incr i} {
> runp $i $sexp
> after 100
> update
> }
> }
>
> this is the run proc (runs and runp are almost the same
> proc runs {percents tos} {
> .h.s coords bars 0 0 [expr ($percents * (20 / $tos))] 20 }
>
> charge* proc are binded with a button but they don't want to calcul in
> the same time.
> my goal is to have "like a progress bar " with rectangle canvas to
> display a time evolution.
>
> i have 2 canvas. they display different time progress...
>
> but i don't succeed
> the charges proc run and only after the chargep begin. or i would like
> they act in the same time.
>
> where do i make a mistake?

Basically you misunderstand what the event loop does and how it works.

Take a close look at:
http://wiki.tcl.tk/946

(and related pages like http://wiki.tcl.tk/event%20loop )

Michael
nicolas

2005-06-08, 4:01 pm

thanks for your help
you were right....

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com