Python pyautogui.FAILSAFE Examples
The following are 6
code examples of pyautogui.FAILSAFE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyautogui
, or try the search function
.
Example #1
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 7 votes |
def test_failsafe(self): self.oldFailsafeSetting = pyautogui.FAILSAFE pyautogui.moveTo(1, 1) # make sure mouse is not in failsafe position to begin with for x, y in pyautogui.FAILSAFE_POINTS: pyautogui.FAILSAFE = True # When move(), moveTo(), drag(), or dragTo() moves the mouse to a # failsafe point, it shouldn't raise the fail safe. (This would # be annoying. Only a human moving the mouse to a failsafe point # should trigger the failsafe.) pyautogui.moveTo(x, y) pyautogui.FAILSAFE = False pyautogui.moveTo(1, 1) # make sure mouse is not in failsafe position to begin with (for the next iteration) pyautogui.moveTo(1, 1) # make sure mouse is not in failsafe position to begin with for x, y in pyautogui.FAILSAFE_POINTS: pyautogui.FAILSAFE = True pyautogui.moveTo(x, y) # This line should not cause the fail safe exception to be raised. # A second pyautogui function call to do something while the cursor is in a fail safe point SHOULD raise the failsafe: self.assertRaises(pyautogui.FailSafeException, pyautogui.press, "esc") pyautogui.FAILSAFE = False pyautogui.moveTo(1, 1) # make sure mouse is not in failsafe position to begin with (for the next iteration) for x, y in pyautogui.FAILSAFE_POINTS: pyautogui.FAILSAFE = False pyautogui.moveTo(x, y) # This line should not cause the fail safe exception to be raised. # This line shouldn't cause a failsafe to trigger because FAILSAFE is set to False. pyautogui.press("esc") pyautogui.FAILSAFE = self.oldFailsafeSetting
Example #2
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def setUp(self): self.oldFailsafeSetting = pyautogui.FAILSAFE pyautogui.FAILSAFE = False pyautogui.moveTo(42, 42) # make sure failsafe isn't triggered during this test pyautogui.FAILSAFE = True
Example #3
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def tearDown(self): pyautogui.FAILSAFE = self.oldFailsafeSetting
Example #4
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def setUp(self): self.oldFailsafeSetting = pyautogui.FAILSAFE self.center = P(*pyautogui.size()) // 2 pyautogui.FAILSAFE = False pyautogui.moveTo(*self.center) # make sure failsafe isn't triggered during this test pyautogui.FAILSAFE = True
Example #5
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def tearDown(self): pyautogui.FAILSAFE = self.oldFailsafeSetting
Example #6
Source File: test_pyautogui.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def setUp(self): self.oldFailsafeSetting = pyautogui.FAILSAFE pyautogui.FAILSAFE = False pyautogui.moveTo(42, 42) # make sure failsafe isn't triggered during this test pyautogui.FAILSAFE = True