Clipboardbuffers.py

From Lucca's Wiki
Revision as of 22:56, 10 December 2024 by 45.27.172.161 (talk) (Created page with "import os import sys from PyHotKey import Key, keyboard from tkinter import * scriptFolder = (os.path.dirname(__file__)) def inputbox(inputBuffer): inputText = "No Input Given Yet" master = Tk() textbox = Entry(master) textbox.pack() textbox.focus_set() def onclick(pos): nonlocal inputText inputText = textbox.get() print(f"Clipboard buffer {inputBuffer} was set to: {inputText}") master.destroy() b = Button(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

import os import sys from PyHotKey import Key, keyboard from tkinter import * scriptFolder = (os.path.dirname(__file__))

def inputbox(inputBuffer):

   inputText = "No Input Given Yet"    
   master = Tk()
   textbox = Entry(master)
   textbox.pack()
   textbox.focus_set()
   def onclick(pos):
       nonlocal inputText
       inputText = textbox.get()
       print(f"Clipboard buffer {inputBuffer} was set to: {inputText}")
       master.destroy()
   b = Button(master, text = "OK", width = 10, command = onclick)
   b.pack()
   textbox.bind('<Return>', onclick)
   mainloop()
   return(inputText)

id2 = keyboard.register_hotkey([Key.ctrl, Key.shift, 'z'], None, inputbox, 1) print(keyboard.hotkeys)