sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #37017
[Question #287177]: Breaking out of a Loop with keyboard Input not working!
New question #287177 on Sikuli:
https://answers.launchpad.net/sikuli/+question/287177
So i literally have been searching a way for me to stop my code if a hotkey or a sequence is pressed .The way to do it with python in windows does not seem to work as sikuli is not shipped with msvcrt module.
After about spending hours looking thorough python documents i stumped upon this Sikuli doc http://doc.sikuli.org/globals.html#listening-to-global-hotkeys , while i felt a bit silly for wasting hours i was glad i found it .The problem is when i made up a quick code to test this function so i can implement it into my program ,it does not seem to work .I know for a fact that when the keys are pressed sikuli detects it because it prints 'BREAK KEY ACTIVATED' .but the loop keeps on running.
def LoopClose(event):
print('BREAK KEY ACTIVATED!')
A ==10
# When the user pressed Ctrl+Alt+F1, click the top-left apple icon.
A =0
Env.addHotkey(Key.SPACE, KeyModifier.CTRL, LoopClose)
while True:
print('NOT WORKING YET')
wait(1)
if A ==10 :
break
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.