← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #229736]: How to wait and refresh untill a image is found ?

 

Question #229736 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/229736

    Status: Open => Answered

Bunnings proposed the following answer:
For your first question, sikuli has

Region.waitVanish(Image path string OR Pattern, Timeout)

The other way to do it is by observing visual events in a region.

Region.OnAppear(Image, myeventhandler)

In the event handler you can say

def myeventhandler(self):
    Region.waitVanish(Image path string OR Pattern, Timeout)

Remember, if using events, you need to take care of start and start
observing, define a timeout carefully.

Sample code from my project below

def CallThisMethodWhenYouNeedTo(self):
        self.screen.onAppear(self._ImgPostingTransactionMessage, self.WaitWhilePostingTransaction)
        self.screen.observe(Timeouts.Observe, background = False)

Event Handler
-----------------------
def WaitWhilePostingTransaction(self, event):
        self.screen.waitVanish(event.match, Timeouts.Wait)
        event.region.stopObserver()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.