I am trying to copy a string to clipboard in Python, as per the question How do I copy a string to the clipboard on Windows using Python?
My current code is:
from Tkinter import Tk
r = Tk()
r.withdraw()
r.clipboard_clear()
variable_desired = "text to copy"
r.clipboard_append(variable_desired)
However, when i paste into notepad, i get the name of the variable (e.g. "variable_desired") copied, rather than the value of that variable. Moreover, it doesn't paste into e.g. the chrome browser.