xxxxxxxxxx
from tkinter import Tk
def Copy(txt):
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append(str(txt))
r.update() # now it stays on the clipboard after the window is closed
r.destroy()
Copy("It Works")
xxxxxxxxxx
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
spam = pyperclip.paste()
xxxxxxxxxx
i am using linux and pyperclip is not working
but this code working in linux python for copy text
from gi.repository import Gtk, Gdk
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text("copy this text mefiz.com", -1)