#linuxcnc-devel | Logs for 2017-01-06

Back
[20:06:31] <mozmck> Hmm, is there a way to check the pressed state of a keyboard key in python?
[20:08:51] <Tom_L> http://stackoverflow.com/questions/292095/polling-the-keyboard-detect-a-keypress-in-python
[20:09:38] <mozmck> Thanks. I saw that but I'm not sure if that is something I can use to get the state of a specific key?
[20:10:01] <Tom_L> you'd probaby have to do a compare for the key
[20:10:16] <Tom_L> that's how i do in in another language
[20:10:43] <mozmck> Huh, I guess I need to look up what select returns
[20:10:56] <Tom_L> if K_ESC for example
[20:11:35] <Tom_L> http://www.pygame.org/docs/ref/key.html
[20:11:36] <mozmck> What I'm wanting to do is not rely on keyboard events for key jogging. I want to check the key state each round of the hal thread.
[20:11:42] <Tom_L> dunno if that's free..
[20:12:46] <mozmck> Yeah, I don't want to include pygame either :-) Maybe I can see what they do in their code though if it's open source.
[20:13:03] <Tom_L> that's probably what i'd do
[20:14:54] <Tom_L> https://pypi.python.org/pypi/pynput/1.1.7
[20:15:03] <Tom_L> that one may be a little easier to figure out
[20:15:24] <mozmck> I almost think it might be best if continuous jogging in linuxcnc was something that has to be poked to keep going. That way if the GUI hangs or keyboard gets unplugged, the back end will stop jogging if it's not poked within 100 ms or so.
[20:15:43] <Tom_L> i'd agree with that
[20:16:02] <mozmck> Thanks for the links! I did not find pynput
[20:19:21] <Tom_L> http://code.activestate.com/recipes/134892/
[20:19:23] <Tom_L> fwiw
[20:21:36] <Tom_L> i should learn python
[20:22:20] <Tom_L> looks too oops ie to me
[20:24:24] <Tom_L> http://matplotlib.org/examples/event_handling/keypress_demo.html
[20:25:22] <Tom_L> meh, another library