stopping tkinter callbacks

Mike Fletcher mfletch at tpresence.com
Sun Aug 27 21:49:07 EDT 2000


You might try using a threading.Lock() ?  That is:


def OnClick( self, event ):
	if self.buildingWhateverLock.acquire( blocking=0 ):
		# build here, you have the building lock
		# make sure you call this when done!
		self.buildingWhateverLock.release()
	else:
		# ignore here, you don't have the lock
		# possibly give some sort of "patience already"
		# feedback (maybe make a sound, or whatever)

See documentation on the threading module for more info.

HTH,
Mike

> -----Original Message-----
> From: Bob van der Poel [mailto:bvdpoel at uniserve.com]
> Sent: Sunday, August 27, 2000 8:59 PM
> To: python-list at python.org
> Subject: stopping tkinter callbacks
> 
...
> 	- A button or menu is bound to the function Spam
> 	- when Spam is called it has to create a complicated 
> window. This
> 		takes a second or so. Once the window is created it
> 		grabs the focus, so hitting the button again is ignored
> 		since the window with the button is no longer active.
> 	- Life is wonderful
> 
> However, if the user clicks the button a 2nd time while the 
> Spam window
> is being created...2 (or more) windows are now created.
...




More information about the Python-list mailing list