Why not work in an "or" way?

Asked by 谢宝良 on 2017-12-25

while ( Region(611,14,45,42).exists("1514209213957.png")==None) or Region(1061,81,60,66).exists("1514209452991.png")==None):
 print 1

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-12-25
Last reply:
2017-12-25
RaiMan (raimund-hocke) said : #1

while ( Region(611,14,45,42).exists("1514209213957.png")==None) or Region(1061,81,60,66).exists("1514209452991.png")==None):

... not sure wether this is a typo: gives syntax error due to mismatched )

Guessing your intention, this should work:
while(not Region(611,14,45,42).exists("1514209213957.png") or not Region(1061,81,60,66).exists("1514209452991.png")):
  print 1

even better and faster:
while True:
    first = Region(611,14,45,42).exists("1514209213957.png", 0)
    second = Region(1061,81,60,66).exists("1514209452991.png", 0)
    if (not first or not second):
       print "first:", first
       print "second:", second
       wait(1)
    else:
       break

Can you help with this problem?

Provide an answer of your own, or ask 谢宝良 for more information if necessary.

To post a message you must log in.