In C or Python its possible to read current keyboard input without waiting
Scilab function “input” waits til return key is pressed and returns a string.
For direct control of program flow, a command like kbhit or keypressed will be useful, to react on single keystrokes.
What isvan easy way to implement such a behaviour
Hello,
This is possible but when only when the graphic window has the focus: see seteventhandler - Set an event handler for the current graphic window
S.
Hello Stefan
Thanks for your infos.
I implemented the following eventhandler , based on the example from the help.
It stores current keystroke in a string variable::
global ch1;
function my_eventhandler(win, x, y, ibut)
global ch1;
if ibut > 32 then ch1=char(ibut) , end
endfunction
What do you think about the following solution, which uses python in scilab::
import keyboard ; module keyboard from python is loaded.
char1 = keyboard.read_key()
It seems to be simpler, but does it work?
Wolfgang
No idea. How do you use Python in Scilab ?
S.