Sikuli code in Sikuli-IDE doesn't appear

Asked by Hiram Landeros on 2020-12-19

I start the program in Sikuli-IDE, it does what it supposed to do. I press the ctrl-F12 to end the program and the program stops as expected, sadly the code window Sikuli doesn't appear until I quit and restart Sikuli. I tried also with break-key (ctrl-cmd-C) and same result. All the menus of Sikuli are available, yet they do not do anything, and the code window doesn't display until Sikuli is restarted.

Sometimes it crashes after I press a menu of Sikuli (after the code execution is terminated and Sikuli doesn't reappear). I haven't been able to determine what makes that every so often it crashes.

Sometimes the menus are not available at all (except the Sikuli one) after the code execution is terminated and Sikuli doesn't reappear. I haven't been able to determine what makes that every so often it becomes unresponsive and need to terminate the program.

Additionally, if I comment out the command wd.observe(), then I can start and end the code as expected, but not when it executes!

Sikuli 2.0.4
MacOS 11.1

This is my test code:
bs = App.focus("testApp")
global wd
wd = bs.window()

def breakHandler(event):
    global loopctl
    loopctl = False

def clickevent1(event):
    global e1
    global e2
    print("Event1", event.getCount())
    ar = event.getRegion()
    ar.hover()
    wait(2)
    ar.setInactive(e1)
    ar.setActive(e2)

def clickevent2(event):
    global e1
    global e2
    print("Event2", event.getCount())
    ar = event.getRegion()
    ar.hover()
    wait(2)
    ar.setInactive(e2)
    ar.setActive(e1)

global e1
global e2
e1 = wd.onAppear(Pattern("e1.png").similar(0.80), clickevent1)
e2 = wd.onAppear(Pattern("e2.png").similar(0.80), clickevent2)

Env.addHotkey(Key.F12, KeyModifier.CTRL, breakHandler)

wd.observe()

global loopctl
loopctl = True

while loopctl:
    wait(1)

wd.stopObserver()

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-12-19
Last reply:
2020-12-20
Hiram Landeros (gueritol) said : #1

Additionally, if I comment out the 2nd onAppear, then the program behaves as expected. Apparently, with more than 1 onAppear in the region, Sikuli doesn't return after program is halted!

RaiMan (raimund-hocke) said : #2

ok, thanks.

I have to check.

tracked on Github:
https://github.com/RaiMan/SikuliX1/issues/401

Can you help with this problem?

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

To post a message you must log in.