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

AttributeError: 'PyKeyboard' object has no attribute 'left_key' #121

Open
kadanes opened this issue Nov 21, 2020 · 1 comment
Open

AttributeError: 'PyKeyboard' object has no attribute 'left_key' #121

kadanes opened this issue Nov 21, 2020 · 1 comment

Comments

@kadanes
Copy link

kadanes commented Nov 21, 2020

I am following the readme and getting this error.

>>> from pykeyboard import PyKeyboard
>>> k = PyKeyboard()
>>> k.tap_key(k.left_key);
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'PyKeyboard' object has no attribute 'left_key'

So I tried using the x11 file because I saw that base didn't really have any definitions.

>>> from pykeyboard.x11 import PyKeyboard
>>> k = PyKeyboard()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/pykeyboard/x11.py", line 41, in __init__
    self.display = Display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/protocol/display.py", line 84, in __init__
    name, protocol, host, displayno, screenno = connect.get_display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/support/connect.py", line 73, in get_display
    return mod.get_display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/support/unix_connect.py", line 76, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name "/private/tmp/com.apple.launchd.mzfduZgMBG/org.macosforge.xquartz:0"

Finally, I tried using mac.py. But that file does not have all the keys defined. And the ones that are defined don't work.

>>> from pykeyboard.mac import PyKeyboard
>>> k = PyKeyboard()
>>> k.tap_key('UP_ARROW_KEY');
@shininome
Copy link

I also encountered the same problem. Did you eventually find a solution?

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