Python Forum

Full Version: How to listen to clipboard content change without polling the clipboard continuously?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am new here, please excuse any mistakes in the post.

I am trying to create a GUI application using tkinter, which would run in the background and listen for clipboard content changes. When the content of the clipboard changes, the app would automatically add the clipboard content to the app's list.

I want the app to be able to run on both Linux and Windows properly.

But, I don't know how to listen for clipboard content changes without polling the clipboard continuously.

So far, I have found on Windows docs for monitoring clipboard that I need to create clipboard format listener and if I do so my app would receive a WM_CLIPBOARDUPDATE message when the contents of the clipboard changes.

But, I don't know how I would go about doing these using Python. Someone please help me by telling me the right way to implement it.

Also, I have not been able to find any similar way to listen for clipboard updates on Linux. So, I need help on this regard too.

I would be really grateful if someone could point me to the right direction.