with reg:
print "TO:", getAutoWaitTimeout()
start = time.time()
i = 0
while not exists(Pattern("some_not_visible.png").exact()):
print time.time() - start
start = time.time()
i += 1
if i > 1: break
--- prints
reg.TO: 0.5
TO: 0.5
0.667000055313
0.669000148773
--- BTW:
I do not really see an advantage using "with" for just saving some repeated usage of some_region. and having an additional indent level.
In my opinion the explicit usage of the dotted version with the prefixed region makes things much clearer and you then know throughout the script, that an undotted usage like click() addresses the screen.
--- One more thing:
In 1.1.0 there is an alternative for with:
use(some_region)
click() # is processed against some_region
…
use()
click() # now again uses SCREEN
I added this to support switching between screens in a multi monitor environment including remote screens.
But it can as well be used with a region and saves the additional indent.
confirmed: bug in 1.0.1
fixed in 1.1.0:
--- testscript: Timeout( 1) Timeout( )
reg = Region(0,0,100,100)
reg.setAutoWait
print "reg.TO:", reg.getAutoWait
with reg: out() Pattern( "some_not_ visible. png").exact( )):
print "TO:", getAutoWaitTime
start = time.time()
i = 0
while not exists(
print time.time() - start
start = time.time()
i += 1
if i > 1: break
--- prints
reg.TO: 0.5
TO: 0.5
0.667000055313
0.669000148773
--- BTW:
I do not really see an advantage using "with" for just saving some repeated usage of some_region. and having an additional indent level.
In my opinion the explicit usage of the dotted version with the prefixed region makes things much clearer and you then know throughout the script, that an undotted usage like click() addresses the screen.
--- One more thing:
In 1.1.0 there is an alternative for with:
use(some_region)
click() # is processed against some_region
…
use()
click() # now again uses SCREEN
I added this to support switching between screens in a multi monitor environment including remote screens.
But it can as well be used with a region and saves the additional indent.