PyUserInput
PyUserInput copied to clipboard
Press Shift not working
I cloned the repository and installed. "Finished processing dependencies for PyUserInput==0.1.9" Then I did the following... me$ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import pykeyboard kb = pykeyboard.PyKeyboard() kb.press_key(kb.shift_key)
No error was thrown, but my machine is not acting like 'shift' was pressed.
I'm on Mac 10.9.3
Some changes have been made to the mac module of PyKeyboard lately, but they all were all pretty straightforard in fixing bugs or improving additional key support. Visual inspection of the code doesn't immediately suggest a fault... Could you try the following:
import pykeyboard
kb = pykeyboard.PyKeyboard()
kb.press_key(kb.shift_key)
kb.tap_key('t')
kb.release_key(kb.shift_key)
kb.tap_key('t')
The aim of this snippet is to test for shift case changes, as well as to test general key value mapping. Does Mac have xev
and xmodmap
or equivalents to do some manual key event testing?
Here is what I get from the code above
ipdb> import pykeyboard ipdb> kb = pykeyboard.PyKeyboard() ipdb> kb.press_key(kb.shift_key) ipdb> kb.tap_key('t') ipdb> t
ipdb> kb.release_key(kb.shift_key) ipdb> kb.tap_key('t') ipdb> t
I have an app called "Key Codes" when I hit "shift" Press: Key Code: 65535 / 0xffff Modifiers: 131330 / 0x20102
Release Key Code: 65535 / 0xffff Modifiers: 256 / 0x100
I think I'm repeating @tomatobrown here - I get "Tt"
So shift+A_key is working :)
I have a feeling that @tomatobrown is on to something though..
Actually, it's not working for me - I get "tt"
I'm starting to think it's related to my environment, i just going to use osascript key down command on mac
Ok @tomatobrown try using my fork https://github.com/willwade/pyUserInput - I have a sneaky feeling this should work.. (just replace mac.py with my one if you don't want to grab the whole project..)
and try this:
import pykeyboard
k = PyKeyboard()
k.press_key('shift')
k.tap_key('t')
k.release_key('shift')
k.tap_key('t')
Thanks @willwade the change you made to mac.py fixed this problem for me. Your sneaky suspicion was right.
Good to know, I am looking through the changes you made @willwade . Thanks!
Hi @all!
And thanks about this project!
I have test the shift_ley
with the left_left
for a text's selection on a Windows.
And, it's were not a success. Therefore, I report this problem.
Code used:
import time;
import pykeyboard;
time.sleep(1);
#I go in a text's application
k = pykeyboard.PyKeyboard();
k.press_key(k.shift_key);
k.tap_key('t');
k.tap_key(k.left_key);
k.release_key(k.shift_key);