Python 如何在我的垃圾邮件机器人中创建停止按钮?
我想在我的垃圾邮件机器人中创建一个停止按钮 我已经试过做一个按钮,可以像Python 如何在我的垃圾邮件机器人中创建停止按钮?,python,Python,我想在我的垃圾邮件机器人中创建一个停止按钮 我已经试过做一个按钮,可以像 if (self) == 8: break 但这不起作用,因为当我运行这个程序时,它被卡住了,所以当我点击它时,它崩溃了 from tkinter import * import pyautogui import time import multiprocessing root = Tk() e = Entry(root) root.geometry('800x800') while 1 == 1:
if (self) == 8:
break
但这不起作用,因为当我运行这个程序时,它被卡住了,所以当我点击它时,它崩溃了
from tkinter import *
import pyautogui
import time
import multiprocessing
root = Tk()
e = Entry(root)
root.geometry('800x800')
while 1 == 1:
class SpamBot:
def egal(lol):
if lol == 1:
maschiene = 1
sekunden = input('wieviele sekunden?')
while maschiene < sekunden:
maschiene
time.sleep(10)
f = open("meemovie.txt", 'r')
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
def personal(lol):
if lol == 2:
spam = input('spam nachricht?')
oft = int(input('wie oft? (max 2147483647) oder für unendlich die 1 drücken'))
time.sleep(10)
hallo = 1
if oft == 1:
while 1 == 1:
pyautogui.typewrite(spam)
pyautogui.press("enter")
while hallo < oft:
hallo = hallo + 1
pyautogui.typewrite(spam)
pyautogui.press("enter")
def Rickspam(lol):
if lol == 3:
time.sleep(10)
stop = input('klicke hier um zu stoppen')
while 1 == 1:
if not stop == 'ksjhaddftgtgtqwertzuio':
break
f = open('jetztaber', 'r')
stop = input('klicke hier um zu stoppen')
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
stop = input('hallo')
def Muffin(self):
if self == 4:
time.sleep(10)
while 1 == 1:
f = open('Muffin', 'r')
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
def ey(self):
if self == 5:
time.sleep(10)
hallo = 1
while hallo < 100:
hallo = hallo + 1
pyautogui.typewrite('Ey weist du was?')
pyautogui.press("enter")
pyautogui.typewrite('Ach vergiss es ')
pyautogui.press("enter")
def bigwiggle(self):
if self == 6:
time.sleep(10)
while 1 == 1:
f = open('bigwiggle.txt', 'r')
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
def deja(self):
if self == 7:
time.sleep(10)
while 1 == 1:
f = open('deja vu .txt', 'r')
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
button1 = Button(root, text="Beemovie", command=lambda: SpamBot.egal(1), padx=50, pady=30)
button1.place(x=200, y=0)
button2 = Button(root, text="Personal Spam", command=lambda: SpamBot.personal(2), padx=45, pady=30)
button2.place(x=0, y=0)
button3 = Button(root, text="Rick spam", command=lambda: SpamBot.Rickspam(3), padx=45, pady=30)
button3.place(x=400, y=0)
button4 = Button(root, text="Muffin time", command=lambda: SpamBot.Muffin(4), padx=45, pady=30)
button4.place(x=600, y=0)
button5 = Button(root, text="Ey?", command=lambda: SpamBot.ey(5), padx=45, pady=30)
button5.place(x=0, y=100)
button6 = Button(root, text="BIg wiggle", command=lambda: SpamBot.bigwiggle(6), padx=45, pady=30)
button6.place(x=150, y=100)
button7 = Button(root, text="deja vu", command=lambda: SpamBot.deja(7), padx=45, pady=30)
button7.place(x=350, y=100)
root.mainloop()
使用键盘库: 安装:
pip3 install keyboard
用法:
if keyboard.is_pressed('a'):
exit()
或者,如果您希望它在while循环中:
running = True
while running:
if keyboard.is_pressed('a'):
running = False
对于您的代码,请首先说明为什么在1==1:时使用?它总是正确的,它的不定式循环不一定是坏的,但在正确的时候使用它更有意义:谢谢现在起作用了:Dno问题!请你回答:P