How do I paste the copied text from keyboard in python
问题 If I execute this code, it works fine. But if I copy something using the keyboard ( Ctrl + C ), then how can I paste the text present on clipboard in any entry box or text box in python? import pyperclip pyperclip.copy('The text to be copied to the clipboard.') spam = pyperclip.paste() 回答1: You will want to pass pyperclip.paste() the same place you would place a string for your entry or text widget inserts. Take a look at this example code. There is a button to copy what is in the entry field