title: Create Copy and Paste function with Python
body: <p>I am looking for a solution to add a function to a program using Python. I want to copy and paste selected data (selected with the mouse).</p>
  
  <p>Example:</p>
  
  <ol>
  <li>Copy "Hello" using CTRL-C from the sentence "Hello everybody" when I select Hello.          </li>
  <li>Copy a part of array selected using CTRL-C</li>
  </ol>
  
  <p>My main problem is how to use the selected data.  But now I just can copy string defined in the code (here "tt"):</p>
  
  <pre><code>clipboard.OpenClipboard()
  clipboard.EmptyClipboard()
  clipboard.SetClipboardText('tt')
  clipboard.CloseClipboard()
  </code></pre>
  
  <p>I tried several codes found on the internet and in this website but none of them fixed my problem.</p>