i´ve been working on a script that displays a keyboard when I press a specific button on a controller with tkinter . The idea behind it was that I wanted to use my computer without a mouse or keyboard. The Keyboard already works, however if I press a key on the generated keyboard the response will obviously go to the keyboard window, which could only be used to copy the written string and paste it via the button later. But I want the keyboard window to send the response directly to the input field. Is there any way you can achieve this? Does anyone know if there are libraries that could do that? (best would be a method for tkinter, which is not OS specific)
Im using Python 3.8 on Mac Os high sierra
The code looks something like this
def b_1_response():
keyboard.press("1")
keyboard.release("1")
def createKeyboard(keymode):
window = tk.Tk()
window.overrideredirect(1)#removes the title bar
window.overrideredirect(0)#need to do this because mac os is stupid sometimes :/
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
y = screen_height - keyboard_height
x = (screen_width - keyboard_width)/2
settings = str(keyboard_width) + "x" + str(keyboard_height) + "+" + str(x) + "+" + str(y)
window.configure(bg="#1C1C1C")
window.geometry(settings)
button_1 = Button(window, text=keymode[0], bg="black", fg="white", command=b_1_response, height=90, width=90)
window.mainloop()
I haven´t really tried anything because I couldn´t find similar questions to this in python, but heres a similar question in java: Sending a keyboard event from java to any application (on-screen-keyboard) Im also not very experienced with programming and this is my first questions so please don´t be too harsh :D