Clipboard Monitor (tkinter,windows)

Gabriel Genellina gagsl-py2 at
Fri Aug 24 22:42:23 CEST 2007

En Fri, 24 Aug 2007 06:35:05 -0300, Peter Sutton  
<annannienann at> escribi�:

> Hi. I am an A-level student studying computer science. I have taken it  
> upon myself to learn python. It is now my weapon of choice. I have had a  
> problem trying to creating a clipboard monitor in Windows(XP,Vista) that  
> is linked to a tkinter GUI. I have a perfectly good code for clipboard  
> monitoring, but as soon as it is linked to a tkinter gui, the gui locks  
> when a WM.DRAWCLIPBOARD message is recieved. I am at the point of giving  
> up. If anyone can help or offer an alternative...that is not  
> polling....I would be very happy.  Thanks. Peter

Removing this line:
	 self.l["text"] = "Lord be Praised"
and it works fine.
I'm not a Tk expert but I think it doesn't like sending another message  
 from inside a message handler.

I'd try to decouple both actions; inside OnDrawClipboard just save the  
clipboard contents in an instance attribute, and then invalidate the  
window; show the contents on response to wm_paint messages.

Gabriel Genellina

More information about the Python-list mailing list