Today I have spent most of the time fixing the “Auto typer” I made a while ago. which turned out to be really easy and short. all I needed was this
import keyboard
import time
text = input("Select the Auto text")
while True:
if keyboard.is_pressed("w"):
keyboard.write(text, delay=0) # no delay at all
time. Sleep(0.1)
the text input so you can pick what it writes, I did not need a function for it since it’s really short and it does one task anyways. After I tested it out and made sure it works, I decided to Turn both clickers into a Gui which looks like this
from tkinter import *
from tkinter import ttk
import time
import keyboard
import threading
root = Tk()
frm = ttk.Frame(root, padding=100)
frm.grid()
ttk.Label(frm, text="Enter auto text:").grid(column=0, row=0)
text_entry = ttk.Entry(frm, width=30)
text_entry.grid(column=1, row=0)
def keyboard_auto():
text = text_entry.get()
def loop():
while True:
if keyboard.is_pressed("w"):
keyboard.write(text, delay=0)
time.sleep(0.1)
threading.Thread(target=loop, daemon=True).start()
ttk.Button(frm, text="Press W to activate", command=keyboard_auto).grid(column=0, row=1)
# Quit button
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=1)
root.mainloop()