1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| from clipboard import paste, copy
from pynput.keyboard import GlobalHotKeys, Controller
from tkinter import Tk, Listbox, Button, Frame
from tkinter import Scrollbar, Y, LEFT, RIGHT, TOP
# import tkinter as Tk
global var
global Lb
var = []
keyboard = Controller()
def metdansvar():
global var
var.append(paste())
def quitte():
h.stop()
def showclip():
def clic(evt):
i = Lb.curselection()
copy(Lb.get(i))
f1 = Frame(root)
s1 = Scrollbar(f1)
Lb = Listbox(f1)
for i in range(len(var)):
Lb.insert(i, var[i])
s1.config(command=Lb.yview)
Lb.config(yscrollcommand=s1.set, width=0, height=0)
Lb.pack(side=LEFT, fill=Y)
s1.pack(side=RIGHT, fill=Y)
f1.pack()
Lb.bind('<ButtonRelease-1>', clic)
with GlobalHotKeys({'<ctrl>+q': quitte, '<ctrl>+c': metdansvar}) as h:
root = Tk()
button1 = Button(root, text='Refresh', command=showclip,
padx=10, justify='center', width=50)
button1.pack(side=TOP, fill=Y)
root.mainloop()
h.join() |
Partager