I am trying to following the answer to this question in an attempt to copy to clipboard however all solutions provided in the answer seem to have failed me. On macOS, I have successfully used pyperclip and subprocess.run to copy to clipboard as described in the linked post, however on centOS neither works. I have also tried using Tkinter on macOS however when I run the following simple code:
from tkinter import Tk
r = Tk()
I get the following deprecation warning:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
I don't really want to build my application with deprecated dependencies however seeing that centOS doesn't support pyperclip or subprocess.run I feel like I have no other options.
Specifically I would like to know if there exists a good solution to my problem, that is, I want to copy to clipboard on centOS and ideally, I want a solution that will work on "most" platforms. Please note that I am using python3.
import tkinter
notimport Tkinter
. – Prostrationtkinter
.Here is something maybe will help. – Prostrationpyperclip
uses bash commandxclip
orxsel
so if you have installedxclip
orxsel
then it should work or you can do the same using evensubprocess.run("xclip ....")
. Butxclip
orxsel
may needX11
XWindow
(the same withtkinter
- it needsXWindow
/X11
) – Unbar