def foo():
global interupsi
distance = 50
while distance>0:
pyautogui.drag(distance, 0, duration=0.5) # move right
if interupsi:
break
distance -= 5
pyautogui.drag(0, distance, duration=0.5) # move down
if interupsi:
break
pyautogui.drag(-distance, 0, duration=0.5) # move left
if interupsi:
break
distance -= 5
pyautogui.drag(0, -distance, duration=0.5) # move up
if interupsi:
break
Any there way to make each statement efficient? if statements can stored to array or list, it will be easier just do with iterration. I expect like this
statement_list=[statement1,statement2,statement3,statement4]
def foo():
global interupsi
distance = 50
while distance>0:
for statements in statement_list
statements()
if interupsi:
break
so the statements saved to list named statement_list and it called with itteration so it will be efficient, i dont need copy paste if interrupsi: repeteadly, note:the interupsi variabel may be changed whenever.
Aucun commentaire:
Enregistrer un commentaire