How do I have a fail safe command in python

后端 未结 3 2024
名媛妹妹
名媛妹妹 2021-01-22 10:51

So I\'m trying to make a program that randomly places my mouse in specific areas in python, and I\'m still testing it so it can get a bit crazy. I was wondering if it were poss

3条回答
  •  野性不改
    2021-01-22 11:27

    this should work, whenever you click the key it will break the loop, install the module keyboard with

    pip install keyboard
    
    if keyboard.is_pressed('q'):
        break
    

提交回复
热议问题