I have this code which breaks the loop when pressed the "P" key but the loop is not working unless I press a key that is not "P"
def main():
openGame()
while True:
purchase()
imageGrab()
if a.sum() >1200:
fleaButton()
time.sleep (0.01)
grab()
if b.sum() <=9:
pressOk()
time.sleep (0.01)
if keyboard.read_key() == "p":
print("Stopping the bot.")
break
print("Press 'F1' key to stop the bot.")
input("Press enter to start the bot.")
main()
I am a newbie on programming and dont know what to do with this :(
Also, I've been looking for a code that allows me pause the loop when I press a key and continue the loop when I press a key. Thanks in advance.