pastebin - collaborative debugging tool
python.kpaste.net RSS


Python Tkinter Clipboard
Posted by Anonymous on Fri 10th Mar 2023 02:22
raw | new post

  1. # bare minimum get text from clip board
  2. from tkinter import *
  3.  
  4. def myClick():
  5.     cliboardContents = root.clipboard_get()
  6.     cliptext = str(cliboardContents)+"\n"
  7.     print("cliptext",cliptext)
  8.     theTextArea.insert("end-1c",cliptext)
  9.  
  10. root = Tk()
  11. myButton = Button(root, text="Get Clipboard", command=myClick)
  12. theTextArea = Text(root, height = 5, width = 52)
  13.  
  14. myButton.pack()
  15. theTextArea.pack()
  16.  
  17. root.mainloop()

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at