Advertisement
furas

Python - turtle - clipboard

Jul 6th, 2018
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import turtle
  2.  
  3. canvas = turtle.getcanvas()
  4. root = canvas.winfo_toplevel()
  5.  
  6. root.clipboard_clear()
  7.  
  8. try:
  9.     print('clipboard:', root.clipboard_get())
  10. except Exception as ex:
  11.     print('clipboard is empty or object is not string')
  12.     print('ERROR:', ex)
  13.  
  14. root.clipboard_clear()
  15. root.clipboard_append("Hello ")
  16. root.clipboard_append("World")
  17.  
  18. try:
  19.     print('clipboard:', root.clipboard_get())
  20. except Exception as ex:
  21.     print('ERROR:', ex)
  22.     print('clipboard is empty or object is not string')
  23.     print('ERROR:', ex)
  24.  
  25. turtle.done()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement