pythoncard: what's wrong in my code?

Riccardo Galli riccardo at Togli_Quest0sideralis.net
Sun Jan 12 17:45:33 CET 2003


This little program start a thread, which every 1 second modify a text
widget.
The problem is that, often, when I run it the text is written ON the old
text, without changing the old text value. It's like to write always on the
same paper: in a short time the paper is completely black

The real program is bigger, of course, but this is the minimum code which
can produce the error

if someone can help me....
Thanks,
Riccardo

class Retriever(Thread):
		def __init__(self,components):
			Thread.__init__(self)
			self.components=components	#this is a dirty trick I use to see self.components of the main apllication
		
		def run(self):
			seconds=0
			while 1:
				self.components.counterStText.text=str(seconds)
				seconds+=1
				time.sleep(1)

class myclass(model.Background):
	def on_openBackground(self, event):
		aThread=Retriever(self.components)
		aThread.start()

if __name__ == '__main__':
    app=model.PythonCardApp(myclass)
    app.MainLoop()



-- 
-=Riccardo Galli=-

 _,e.
s~  ``
 ~@.   ideralis Programs
.   ol 
 `**~  http://www.sideralis.net





More information about the Python-list mailing list