Recursing for Progress Bar

half.italian at gmail.com half.italian at gmail.com
Tue Sep 19 06:34:24 CEST 2006


DOLT!

Thanks!

Dennis Lee Bieber wrote:
> On 18 Sep 2006 19:38:48 -0700, "half.italian at gmail.com"
> <half.italian at gmail.com> declaimed the following in comp.lang.python:
>
> >
> > Is there a way to get around recursion limits?  Help!
> >
> 	Yes... restructure your code to not use recursion...
>
> 	Should be easy since your incomplete snippet implied that there is
> NO RETURN VALUE. Recursion is often used when the value of a computation
> has to be fed to the next higher level of the calculation (the infamous
> factorial:
>
> 	fact(6)	=	6 * fact(6-1)
> 					5 * fact(5-1)
> 						4 * fact(4-1)
> 							3 * fact(3-1)
> 								2 * fact(2-1)
> 									1	(by definition: fact(1) = 1)
> 								2
> 							6
> 						24
> 					120
> 				720
>
> >
> >       def incrementProgress(self, window, workorder):
> >
> 		while self.p < 100 and workorder.contents:
> 			dest_count = workorder.copyIndex
> 			self.label.config(text=workorder.movingFile)
> 			src_count = len(workorder.contents)
> 			self.p = (float(dest_count) / float(src_count)) * 100.0
> 			print "Percentage copied:", self.p
> 			self.progressBar.updateProgress(self.p)
> 			time.sleep(0.1)
>
> 		window.destroy()
> 		self.p = 0
> 		return
>
>
> --
> 	Wulfraed	Dennis Lee Bieber		KD6MOG
> 	wlfraed at ix.netcom.com		wulfraed at bestiaria.com
> 		HTTP://wlfraed.home.netcom.com/
> 	(Bestiaria Support Staff:		web-asst at bestiaria.com)
> 		HTTP://www.bestiaria.com/




More information about the Python-list mailing list