我正在尝试按照以下方式做一些事情:
#setup stuff
from Tkinter import Tk
clp=Tk()
clp.withdraw() #keep window from showing
clp.clipboard_clear()
stuff=['this','is','stuff'])
count = 0
while 1:
if(clp.userPastesClipboard()): #is there a some sort of function for this?
if(count <= len(stuff)):
clp.clipboard_append(stuff[count])
count += 1
else:
exit()
我基本上只是希望能够在用户从剪贴板粘贴(到任何应用程序)时触发 if/while 语句。我不必使用 Tkinter 库,所以如果有更好的库可用于此,请告诉我,但如果我可以使用 Tkinter 做到这一点,那就更好了。使用 Python 2.7。如果可能,我更喜欢使用标准库,但如果绝对必要,我会使用第 3 方。谢谢。