Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keybindings #17

Open
hdmxxy opened this issue Sep 23, 2018 · 1 comment · May be fixed by #24
Open

Keybindings #17

hdmxxy opened this issue Sep 23, 2018 · 1 comment · May be fixed by #24

Comments

@hdmxxy
Copy link

hdmxxy commented Sep 23, 2018

Is there any way to make my key 1 and 2 to arrows? I've tried putting "left arrow" or ← but none work. Thanks in advance and great project.

@GarrettBurroughs
Copy link

Looking at how the code is written, the correct binding would be "up", "down", "left", and "right", for arrow keys, because of how key_pressed() works
You can read about it here

but there is also a check that makes it so that the key codes are 1 character wrong.

I would suggest changing the code from

if len(k1) == 1 and len(k2) == 1:
        break
    else:
        print('Keys can only be 1 character long')

to

arrowKeys = ["up", "down", "left", "right"]
if len(k1) == 0 or k1 in arrowKeys and len(k2) == 0 or k2 in arrowKeys:
    break;
else:
    print('Keys can only be 1 character long, or arrow keys such as \'up\', \'right\', \'left\', or \'down\'')

I'll test this out on my own and submit a PR for it if it works

@GarrettBurroughs GarrettBurroughs linked a pull request Sep 27, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants