HowTo: use the hotkey feature

Asked by kavitha

 Hello,

   I have written a code in sikuli to make calculator to perform addition repeatedly using While loop. But I have also defined "runhotkey" function, so that if I press the hotkey , loop should gets stopped. Following is the code for the same.

def runHotKey(event):
    global running
    running = False
    Env.addHotkey(Key.F1,KeyModifier.CTRL, runHotKey)

   When Sikuli is running and If I press CTRL+F1 after sometime, It is not reacting at all...

Can you please provide some solution for this?

Thanks,
Kavitha

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

There now is a more generic example now in the docs:
http://sikulix-2014.readthedocs.io/en/latest/interaction.html#listening-to-global-hotkeys

... the main script needs some loop, to keep it alive.

Can you help with this problem?

Provide an answer of your own, or ask kavitha for more information if necessary.

To post a message you must log in.