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

ESC_KEY doesn't trigger on macOS Mojave #52

Open
antoinedelia opened this issue Oct 15, 2019 · 2 comments
Open

ESC_KEY doesn't trigger on macOS Mojave #52

antoinedelia opened this issue Oct 15, 2019 · 2 comments

Comments

@antoinedelia
Copy link

Hey,

I tried implementing a keyboard event as seen in the check.py example.

I have something rather simple:

from bullet import Bullet, keyhandler
from bullet.charDef import ESC_KEY

class EscapeBullet(Bullet):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    @keyhandler.register(ESC_KEY)
    def accept(self):
        print('yes')
        raise Exception

But upon pressing ESC, the code doesn't do anything.
If I try to change ESC_KEY with BACK_SPACE_KEY, then the code is working as intended.

Do you know what could be the issue regarding this?

Thanks a lot.

@rcfox
Copy link
Contributor

rcfox commented Oct 15, 2019

Looks like getchar() might be preventing the return of ESC_KEY. https://github.com/Mckinsey666/bullet/blob/master/bullet/utils.py#L35

@antoinedelia
Copy link
Author

Even when tweaking the code to force the return of the ESC_KEY, it looks like the getchar() function only triggers half of the time when using ESC_KEY. For other inputs, it works fine all the time.

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

No branches or pull requests

2 participants