On Tuesday, November 10, 2015 at 10:07:17 AM UTC, Felipe Jiménez wrote: > while true > # do stuff # > if (keyboard was pressed) && (key was 'p') # for "pause" > >
> Any ideas? > Hopefully I'm not complicating, something like this seems not be enough (as you could be piping into stdin and something like this would not work): http://www.cplusplus.com/reference/cstdio/getchar/ You want something like "kbhit()" it seems: http://www.cprogramming.com/fod/kbhit.html "Header File: conio.h Explanation: This function is not defined as part of the ANSI C/C++ standard. It is generally used by Borland's family of compilers." https://support.microsoft.com/en-us/kb/43993 http://cboard.cprogramming.com/c-programming/63166-kbhit-linux.html I believe this is OS dependent (and last time I did something similar keyboard related, it was on non-Julia supported OS, RISC OS..). readline is good, would be great if Julia Base would abstract away the differences between the lower-level keyboard access the OSes use.. but since you didn't find anything I guess you can rule out that it has been done already.. There might be one exception. Ctrl-C works I think in all OSes(?) but should kill your program, maybe you can trap that, but probably easier to concentrate on non-Ctrl-C working for you. The only game library I know available to Julia is kind of an overkill..: https://github.com/zyedidia/SFML.jl But this is something (a wrapper for a C++ game library) they have to deal with (and much more..) and you could even let a joystick [button] exit your loop.. Python for sure must have some way (or at least a [wrapper] library). They have SDL game library wrapped with PyGame, and I tried to google something else: http://stackoverflow.com/questions/676713/is-there-a-cross-platform-python-low-level-api-to-capture-or-generate-keyboard-e With PyCall.jl you could get at anything Python has access too. I hope its not too slow, you could check e.g. every tenth iteration of the loop then). Maybe Tk directly is possible directly, best option?) or Tkinter: http://www.ehow.com/how_10015489_check-keypress-python.html You could also easily access the OS dependent parts directly.. Might be enough for you, but please (someone) then make a package with that method, so it can be special-cased/extended with @Linux etc. (end eventually incorporated into Base..). -- Palli.
