With PyGTK 2 I could attach a function to be executed when the contents of the clipboard was changed. Browsing through the documentation of GTK3's python bindings I can not find any description of such an functionality.
Can anyone tell me the 'best practice' for this?
EDIT
With gtk2 the following works:
import gtk
def test(*args):
print "Clipboard changed"
clip = gtk.Clipboard()
clip.connect('owner-change',test)
When adopting to Gtk3
from gi.repository import Gtk, Gdk
def test(*args):
print "Clipboard changed"
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clip.Connect('owner-change',test)
Python accepts the connection to the signal, but my function is never executed.
from gi.repository import Gtk, Gdk
def test(*args):
print "Clipboard changed"
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clip.connect('owner-change',test)
Gtk.main()
works for me.
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