0

I've build what turned out to be quite an extensive script and now I'm trying simplify it. myFunct() repeats most often:

import time
import pyautogui

(...)

img1 = 'images/img1.png'
img2 = 'images/img2.png'

def doSmth1():
    # do stuff

def doSmth2():
    # do stuff

def myFunct():
        while 1:
            if pyautogui.locateOnScreen(img, confidence = 0.9) != None:
                doSmth()
                break
            else:
                time.sleep(0.5)

How can I pass img1 or img2 as img and doSmth1() or doSmth2() as doSmth() into the myFunct()?

Krzysztof
  • 11
  • 1

0 Answers0