Python Forum
How to copy data to clipboard - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to copy data to clipboard (/thread-24784.html)

Pages: 1 2


RE: How to copy data to clipboard - OAP - Mar-19-2020

Apologies for the delay in replying, but I have been distracted by the covid19 panic.

@snippsat
When I run your suggested xsel code I get the following error message
Error:
Traceback (most recent call last): File "/home/george/System/Python/test.py", line 9, in <module> err = run(['xsel', '--clipboard'], capture_output=True, encoding='utf-8') File "/usr/lib/python3.6/subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: TypeError: __init__() got an unexpected keyword argument 'capture_output'
I have tried a few things to fix it but to no avail.

@buran
I have got pyperclip to work using a big string, as you suggested. (The big string has to include field and record delimiters, of course)

The design principle of using Python to code the database engine and Calc to provide the database reports was deliberate. The Calc templates are pre-formatted; I use 'Paste Special' to drop the unformatted db output into them, and I have instantly formatted reports - job finished. The templates are - for me - quick and easy to construct and modify; I have been a spreadsheet power user for 30 years, but am much less familiar with Python, and in particular, have no experience with pandas.

Thank you also for your comments on GUI frameworks. What are the benefits of using the alternatives to Tkinter that you suggested?