@
zictos #10
有人需要脚本吗?用 python 写好了,监听 ctrl+c ,按了后就会在屏幕中间显示当前剪贴板内容的前 50 个字符,2 秒后自动消失。将****用 4 个空格替换。
import tkinter as tk
import time
import keyboard
import pyperclip
def show_toast():
****root =
tk.Tk()
****root.withdraw()
****toast = tk.Toplevel(root)
****toast.overrideredirect(True)
****toast.attributes('-topmost', True)
****toast.geometry(f"+{root.winfo_screenwidth() // 2}+{root.winfo_screenheight() // 2}")
****label = tk.Label(toast, text=pyperclip.paste()[:50], bg='black', fg='white', padx=10, pady=5)
****label.pack()
****root.update()
****time.sleep(2)
****toast.destroy()
if __name__ == "__main__":
****keyboard.add_hotkey('ctrl+c', show_toast)
****keyboard.wait()