sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34862
[Question #272057]: Multiple Observers threading
New question #272057 on Sikuli:
https://answers.launchpad.net/sikuli/+question/272057
Need help in making the below code work. What I'm trying to do is have two regions and simultaneously observing the two regions using threading for images and when they appear, popup stating the image appears
import thread
reg1 = Region(76,61,569,635)
reg2 = Region(680,66,637,622)
def findMario():
reg1.onAppear(r'C:\Sikuli Nightly\Mario_png.PNG', lambda e:popup("Mario Appeared"))
reg1.observe(FOREVER)
def findMushroom():
reg2.onAppear(r'C:\Sikuli Nightly\Mushroom2.PNG', lambda e:popup("Mushroomh Appeared"))
reg2.observe(FOREVER, True)
if __name__ == '__main__':
thread.start_new_thread(findMario,())
thread.start_new_thread(findMushroom,())
The scripts doesn't observer, the moment run is pressed, the script is stopped without any errors. If i observe the whole screen, the following message is displayed
[error] Region: observe: already running for this region. Only one allowed!
Much appreciated if someone can provide resolution
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.