PyAutogui click'a basılı tutma

Öncelikle herkese iyi forumlar
Bir oyun için pyautogui kütüphanesinin click fonksiyonunu kullanıyorum ve başarıyla çalışıyor.
Ama nasıl click fonksiyonuna bekleme ekleyebilirim bilmiyorum ve dökümanlarda bulamadım
Yani sadece istediğim 10 saniye boyunca sağ click’e basılı tutması.
Kod:

from time import sleep
import pyautogui

def bot():
	sleep(15)
	pyautogui.press("r")
	sleep(2)
	pyautogui.press("2")
	sleep(3)
	pyautogui.click(button="right")
	pyautogui.PAUSE = 10
	sleep(2)
	pyautogui.press("1")
	sleep(2)
	pyautogui.press("r")

bot()

https://pyautogui.readthedocs.io/en/latest/mouse.html#the-mousedown-and-mouseup-functions

pyautogui.mouseDown?

Signature:
pyautogui.mouseDown(
    x=None,
    y=None,
    button='primary',
    duration=0.0,
    tween=<function linear at 0x0000020AA8AF3C80>,
    logScreenshot=None,
    _pause=True,
)
Docstring:
Performs pressing a mouse button down (but not up).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    mouse down happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    mouse down happens. None by default.
  button (str, int, optional): The mouse button pressed down. TODO

Returns:
  None

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, or 3
pyautogui.mouseDown(button="right", duration=10.)

selemun aleykum kardeşim işte çözüm

from time import sleep #time modulu içndeki sleep i çekiyor
pyautogui.leftclick() #sol tıklama işlemi
sleep(2) #2saniye bekle
pyautogui.leftclick() #sol tıklama işlemi

1 Beğeni