PyAutoGui可以在我的p的背景下运行吗

2024-05-28 20:30:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我在做一些,比方说,一个程序垃圾邮件发送者。在这种情况下,我使用了一个名为PyAutoGUI的模块,它允许Python移动鼠标、打字甚至按下键盘上的按钮。在

要激活我的程序,我需要在任何窗口,然后按我的程序。例如,我在Facebook上,然后按下程序。它需要写下:我不能上Facebook。在

那么,我的程序怎么能在我的游戏窗口的后台工作呢?在

这是我的代码:

import pyautogui
import time
def spams(xywords):
  x_cor = 962
  y_cor=541
  print(xywords)
  if upali:
    print("Test test")
    pyautogui.click(962,541)
    pyautogui.press("enter")
    pyautogui.typewrite(xywords)
    pyautogui.press("enter")
    time.sleep(3)
    pyautogui.press("enter")
    pyautogui.typewrite('random stuff')
    pyautogui.press("enter")
    time.sleep(4)

spams("HELLO")

Tags: import程序facebooktime垃圾邮件sleeppressprint

热门问题