I'm trying to understand how I can get a program to copy a given text to the system clipboard and then be able to paste that text to any other application systemwide.
I have designed a GUI with Glade and have a GtkEntry and a Button to copy the text, everything works well GUI-wise except I can't get the text in GtkEntry to be copied to the system clipboard when I click the copy button and therefore I am not able to paste it anywhere else.
Here is a bit of the code that I wrote in Python 3.6
def on_copy_Button_clicked(self, button, data=None):
text_Field = builder.get_object("text_Field")
text_Field = str(text_Field.get_text())
pyperclip.copy(text_Field)
Copy comment:
Traceback (most recent call last): File "/home/vittorio/Self-made_programs/Python/Simple Copy-Paste/simple copy-paste.py", line 17, in on_copy_Button_clicked pyperclip.copy(text_Field) File "/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py", line 616, in lazy_load_stub_copy return copy(text) File "/usr/local/lib/python3.6/dist-packages/pyperclip/__init__.py", line 150, in copy_gtk cb = gtk.Clipboard() File "/usr/lib/python3/dist-packages/gi/__init__.py", line 69, in getattr raise AttributeError(_static_binding_error)