def press(key): pressed.add(key) if type(key) == str: if "mouse_" in key: ms.press(key[6:]) return keyboard.press(key)
def press(key): pressed.add(key) # add to the list of pressed keys if type(key) == str: # if the key desciption is a string if "mouse_" in key: # assume (but check that it's a mouse key) ms.press(key[6:]) # then strip "mouse_" and press it return keyboard_api.press(key) # otherwise press the key by keycode