I am working on a clipboard manager. My current issue is to succeed in catching modification of the clipboard from any applications. For instance :
The idea is that a python script is running in background, like a deamon and catch every change of the clipboard
Thank you a lot :)
PS: For people who know autohotkey, I am looking for onClipboardChange equivalent
You can use pandas. read_clipboard() to read the clipboard contents as a DataFrame . It is very useful when used with IPython or Jupyter Notebook. to_clipboard() is also provided to copy the contents of a DataFrame to the clipboard.
In Python, you can copy text (string) to the clipboard and paste (get) text from the clipboard with pyperclip. You can also monitor the clipboard to get the text when updated. asweigart/pyperclip: Python module for cross-platform clipboard functions.
I found in the web a solution using GTK:
from gi.repository import Gtk, Gdk
def callBack(*args):
print("Clipboard changed. New value = " + clip.wait_for_text())
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clip.connect('owner-change', callBack)
Gtk.main()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With