Created
April 28, 2016 09:44
-
-
Save petfactory/6b0054eb81cbd86b9e46b4a6b9946973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
# Python2 | |
from Tkinter import Tk | |
except ImportError: | |
# Python3 | |
from tkinter import Tk | |
def setClipboard(text): | |
root = Tk() | |
root.withdraw() # keep the window from showing | |
root.clipboard_clear() | |
root.clipboard_append(text) | |
root.destroy() | |
def getClipboard(): | |
root = Tk() | |
root.withdraw() | |
text = root.clipboard_get() | |
root.destroy() | |
return text | |
#import sys | |
#print(sys.version) | |
setClipboard('Hello World!') | |
print(getClipboard()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment