Created
November 24, 2017 12:50
-
-
Save GeeWee/2c972c3e04ec461a57d398405ec88d0f to your computer and use it in GitHub Desktop.
Example of a dragonfly Grammar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example_grammar = { | |
# A dragonfly grammar is basically a python dictionary of phrases to the actions they should trigger | |
# With some special syntax for words than can vary. See the up command below, where "[<n>]" in the key means "any number" | |
# Then it's possible to use that number in the action. "up:%(n)d" means press the up key n times | |
# where n was the number from before | |
"up [<n>]": Key("up:%(n)d"), | |
# This allows us to go up by an amount. E.g. saying "up two" will simulate pressing the up button two times | |
"down [<n>]": Key("down:%(n)d"), | |
"space": release + Key("space"), | |
# Saying space will release all other held keys, and simulate a space press | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment