Clipboardbuffers.py: Difference between revisions
From Lucca's Wiki
Jump to navigationJump to search
(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(...") |
No edit summary |
||
Line 1: | Line 1: | ||
import os | import os | ||
import sys | import sys | ||
from PyHotKey import Key, keyboard | from PyHotKey import Key, keyboard | ||
from tkinter import * | from tkinter import * | ||
scriptFolder = (os.path.dirname(__file__)) | scriptFolder = (os.path.dirname(__file__)) | ||
def inputbox(inputBuffer): | 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) | id2 = keyboard.register_hotkey([Key.ctrl, Key.shift, 'z'], None, inputbox, 1) | ||
print(keyboard.hotkeys) | print(keyboard.hotkeys) |
Revision as of 22:57, 10 December 2024
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)