def is_pressed(self, is_pressed): """Sets the state of the button. :param is_pressed True if the button is pressed, False otherwise """ assert (isinstance(is_pressed, bool)) self.vjoy_dev.ensure_ownership() self._is_pressed = is_pressed if not VJoyInterface.SetBtn(self._is_pressed, self.vjoy_id, self.button_id): raise VJoyError("Failed setting button value - {}".format( _error_string(self.vjoy_id, self.button_id, self._is_pressed))) self.vjoy_dev.used()
def is_pressed(self, is_pressed): """Sets the state of the button. :param is_pressed True if the button is pressed, False otherwise """ assert(isinstance(is_pressed, bool)) self._is_pressed = is_pressed if not VJoyInterface.SetBtn( self._is_pressed, self.vjoy_id, self.button_id ): raise VJoyError("Failed updating button state") self.vjoy_dev.used()