Beispiel #1
0
    def key_down(self, key, blocking=True):
        """
        Press down a key (without releasing it)

        :param key:
        :param blocking:
        :return:
        """
        if isinstance(key, str):
            key = Key(key_name=key)
        return self.send_input(key.DOWN, blocking=blocking)
Beispiel #2
0
    def _hold(self, **kwargs):
        bindings = kwargs.pop("bindings", False)
        if bindings == False:
            raise KeyError("bindings not found")

        timer = kwargs.pop("timer", 10)
        delay = kwargs.pop("delay", 200)

        for key, value in bindings.items():
            KeyVal = Key(key_name=value)
            bindings[key] = {
                "up": f"Send {KeyVal.UP}",
                "down": f"Send {KeyVal.DOWN}\nSleep, {delay}",
                "held": f"Send {KeyVal.DOWN}"
            }

        # return self.render_template('joystick/multihold_bind.ahk', bindings = bindings, timer = timer)
        return self._hold_script(bindings=bindings)