Advertisement
KaraHere

Copy on Clipboard

Mar 7th, 2024 (edited)
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import tkinter as tk
  2. from tkinter import ttk
  3. # import paperclip
  4.  
  5.  
  6. count = 0
  7.  
  8. def Click():
  9.     name = button1_Name
  10.  
  11.     global count
  12.  
  13.     count = count + 1
  14.     print(count)
  15.     getdata = window.clipboard_get()
  16.     print(getdata)
  17.  
  18.     if count == 1 and getdata != name:
  19.         button1.clipboard_append(name)
  20.     else:
  21.         return
  22.  
  23.     # button1.update()
  24.  
  25.  
  26.  
  27. window = tk.Tk()
  28. window.geometry('300x300')
  29. window.attributes('-topmost', True)
  30.  
  31. #naming
  32. Prefix = ['ST', 'WS', 'PRP']
  33. Middle = ['Pod', 'Pouffe', 'Sofa']
  34.  
  35. button1_Name = Prefix[0] + '_' + Middle[0]
  36. button1 = ttk.Button(window, text= button1_Name , command=Click)
  37. button1.pack()
  38.  
  39. window.mainloop()
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement