[Tkinter-discuss] Stopping a for loop with a sleep() funciton in it

Alexnb alexnbryan at gmail.com
Sun Jul 13 21:23:29 CEST 2008




Cameron Laird-2 wrote:
> 
> On Thu, Jul 10, 2008 at 10:35:03PM -0700, Alexnb wrote:
> 			.
> 		[hundreds of lines]
> 			.
> 			.
>> I am not that familiar with teh after call, but when I change it to this:
>> 
>> def Open(root):
>> 
>>     bb = BusyBar(root, text='Grabbing Definitions')
>>     bb.pack(side=LEFT, expand=NO)
>>         
>>     bb.on()
>>     root.update_idletasks()
>>     
>>     def sleeper():
>>         root.update()
>>         root.after(100000000, sleeper())
>>         
>>     sleeper()
>> 
>> (notice the () after sleeper in after). It gives me this error.
>> regardless
>> of the number in after. Anyways, I get this error
>> 
>>  root.update()
>> RuntimeError: maximum recursion depth exceeded
> 			.
> 			.
> 			.
> Alex, I'm lost as to what your current status is--what
> you see as solved, and what questions still remain.
> Do you see why the fragment above is unlikely to make
> you happy?  after()'s second argument names a function;,
> it doesn't expect the coder to invoke it.  Does the 
> self-scheduling in <URL:
> http://tkinter.unpythonic.net/wiki/after > make sense?
> How did it not serve you better to write
> 
>      root.after(100000000, sleeper)
> 
> than what you have above?
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 

Well Thats what I said, only, it didn't help. It was for a busy bar and the
bar would stop unless I was using the for loop with the time.sleep() in it.
However, it would always stop at the same spot with after(), but when I used
after(100, sleeper()) vs after(100, sleeper) the sleeper() would still stop,
but it would go a little further down the bar track. If that makes sense.
But I have given up on the idea for now, but thanks for your attempt to
help!

-- 
View this message in context: http://www.nabble.com/Stopping-a-for-loop-with-a-sleep%28%29-funciton-in-it-tp18391735p18432795.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list