diff --git a/spark/core.py b/spark/core.py index ee07ad1..a00433e 100644 --- a/spark/core.py +++ b/spark/core.py @@ -309,8 +309,10 @@ def key_repeated(self): pass # From .util.helper_functions.keyboard_functions @extern - def keys_held(self, *args): - pass + def keys_held(self, *args): pass + + @extern + def key_held(self, *args): pass # From .util.helper_functions.canvas_functions diff --git a/spark/util/helper_functions/keyboard_functions.py b/spark/util/helper_functions/keyboard_functions.py index a9f7979..b81a616 100644 --- a/spark/util/helper_functions/keyboard_functions.py +++ b/spark/util/helper_functions/keyboard_functions.py @@ -66,3 +66,11 @@ def helper_keys_held(self: Core, *keys, pattern=None): pattern = [True]*len(keys) match = [self._keys_held.get(key, False) == want for key, want in zip(keys, pattern)] return reduce(and_, match) + + +@validate_args([str], [str, bool]) +@ignite_global +def helper_key_held(self: Core, *args): + if len(args) == 1: + args.append(True) + return self.keys_held(args[0], pattern=[args[1]]) \ No newline at end of file