python可通过按钮切换功能

时间:2018-08-01 21:31:27

标签: python button

我搞砸了python,并做了一件简单的事情,使它可以在我的PC上运行,从而打开了不和谐的登录并发出了一些消息。我希望它在后台运行并通过按钮使其可切换,因为我从今天才开始学习,所以我都不知道该怎么做!

#以dave山羊和消息狗dave的身份登录

# positions for my icons below

# 20, 137 chrome
# 307, 48 search bar
# 1674, 105 open discord web
# 687, 685 login
# 681, 517 click on email
# 915, 578 click on the right email
# 220, 310 click on dog
# 654, 1034 click on message

import pyautogui
import time

pyautogui.click(20, 137) # click on chrome

time.sleep(0.7)

pyautogui.click(307, 48) # click on search bar

pyautogui.typewrite("discord.com")
pyautogui.typewrite(["enter"])

time.sleep(0.5)

pyautogui.click(1674, 105)

time.sleep(0.7)

pyautogui.click(687, 685)

time.sleep(3.9)

pyautogui.click(220, 310)

pyautogui.click(654, 1034)

pyautogui.typewrite("Dave the goat says hello")
pyautogui.typewrite(["enter"])

0 个答案:

没有答案