import
tkinter as tk
import
tkinter.scrolledtext as scrolledtext
import
tkinter.messagebox as messagebox
import
clipboard
def
get_clipboard_history():
history
=
clipboard.paste()
return
history
def
show_clipboard_history():
history
=
get_clipboard_history()
messagebox.showinfo(
"Clipboard History"
, history)
def
clear_clipboard():
clipboard.copy('')
messagebox.showinfo(
"Clipboard Cleared"
,
"清理完毕."
)
window
=
tk.Tk()
window.title(
"查看剪切板历史记录 by:大白baymax"
)
window.geometry(
"500x500"
)
text_area
=
scrolledtext.ScrolledText(window, wrap
=
tk.WORD)
text_area.pack(expand
=
True
, fill
=
'both'
)
btn_show_history
=
tk.Button(window, text
=
"显示记录"
, command
=
show_clipboard_history)
btn_show_history.pack(pady
=
10
)
btn_clear_clipboard
=
tk.Button(window, text
=
"清除记录"
, command
=
clear_clipboard)
btn_clear_clipboard.pack(pady
=
10
)
window.mainloop()