B
B
B3JlOM_ZHOTTbI2020-06-10 17:30:43
Python
B3JlOM_ZHOTTbI, 2020-06-10 17:30:43

KeySpoof in python?

Hello, I want to write such a thing as KeySpoof, if anyone does not know, this is when you press, for example, q, and another letter is written, so how to create this? just to write not q, but k
here is my code:

from pynput.keyboard import Key, Listener
def on_release(key):
    if keyvvod == True:
        print('{0} release'.format(key))
        if keyid == 1:
            shell.SendKeys(a)
            keyid = keyid + 1
            print(keyid)
        elif keyid == 2:
            shell.SendKeys(b)
            keyid = keyid + 1
        elif keyid == 3:
            shell.SendKeys(c)
            keyid = keyid + 1
        elif keyid == 4:
            shell.SendKeys(d)
            keyid = keyid + 1
        elif keyid == 5:
            shell.SendKeys(e)
            keyid = keyid + 1
        elif keyid == 6:
            shell.SendKeys("{ENTER}")
            keyid = 0
        else:
            return
    
    if key == Key.esc:
        # Stop listener
        print("Stop")
        return False


# Collect events until released
with Listener(on_release=on_release) as listener:
    listener.join()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question