Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyautogui, time, sys
- from tkinter import *
- from PIL import Image,ImageTk
- #counter function
- def counter(counter):
- counter_text = "|Still", counter, "left|"
- label_counter = Label(mGui, text=counter_text, background='#2F343F', fg='white', font='opensans')
- label_counter.grid(row = 4)
- mGui.update()
- #---main function---
- def spam():
- input1 = ment.get()
- input2 = ment4.get()
- howmuch = ment2.get()
- lag = ment3.get()
- send_delay = str(delay.get())
- delay_1 = float(send_delay)
- type_delay = str(typedelay.get())
- delay_2 = float(type_delay)
- time.sleep(lag)
- laenge_eingabe = len(input2)
- if laenge_eingabe > 0:
- count = howmuch
- if howmuch == 1:
- counter(count)
- for x in range(int(howmuch), 0, -1):
- time.sleep(delay_1)
- pyautogui.typewrite(input1, interval=delay_2)
- pyautogui.press('enter')
- else:
- howmuch = howmuch / 2
- for x in range(int(howmuch), 0, -1):
- counter(count)
- time.sleep(delay_1)
- pyautogui.typewrite(input1, interval=delay_2)
- pyautogui.press('enter')
- count = count - 1
- counter(count)
- time.sleep(delay_1)
- pyautogui.typewrite(input2, interval=delay_2)
- pyautogui.press('enter')
- count = count - 1
- else:
- for x in range(howmuch, 0, -1):
- time.sleep(delay_2)
- counter(x)
- pyautogui.typewrite(input1)
- pyautogui.press('enter')
- label_counter = Label(mGui, text="| Done! |", background='#2F343F', fg='white', font='opensans')
- label_counter.grid(row = 4)
- mGui.update()
- #---main function end---
- #GUI
- mGui = Tk()
- #entry variables defined
- ment = StringVar()
- ment2 = IntVar()
- ment3 = IntVar()
- ment4 = StringVar()
- two_or_one = IntVar()
- delay = StringVar()
- typedelay = StringVar()
- mGui.title("Spam")
- mGui.configure(background='#2F343F')
- #---second send-entry field---
- def state():
- var = two_or_one.get()
- if var == 1:
- global entry_1_2
- global label_1_2
- entry_1_2 = Entry(mGui, textvariable = ment4, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
- label_1_2 = Label(mGui, text="Spam message 2", background='#2F343F', fg='white', font='opensans')
- label_1_2.grid(row=1, sticky=W, pady = 10)
- entry_1_2.grid(row=1, column=1)
- else:
- entry_1_2.delete(0, END)
- #entry_1_2.insert(0, "")
- entry_1_2.configure(state='readonly')
- #label_1_2.grid_remove()
- two_or_one = IntVar()
- #---second entry field end---
- #---main window---
- label_1 = Label(mGui, text="Spam message", background='#2F343F', fg='white', font='opensans')
- label_2 = Label(mGui, text="How often should the message be sent?", background='#2F343F', fg='white', font='opensans')
- label_3 = Label(mGui, text="How much time do you need?", background='#2F343F', fg='white', font='opensans')
- label_4 = Label(mGui, text="Send Delay", background='#2F343F', fg='white', font='opensans')
- label_5 = Label(mGui, text="Type Delay", background='#2F343F', fg='white', font='opensans')
- checkbutton = Checkbutton(mGui, text = "two messages", variable=two_or_one, background='#2F343F', fg='white', font='opensans',
- command=state, selectcolor='red', bd='0', highlightbackground='#2F343F')
- button_1 = Button(mGui, text = "Spam!", command = spam, background='#2F343F', fg='white', font='opensans', bd='0')
- entry_1 = Entry(mGui, textvariable = ment, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
- entry_2 = Entry(mGui, textvariable = ment2, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
- entry_3 = Entry(mGui, textvariable = ment3, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
- Slider_1 = Scale(mGui, orient=HORIZONTAL, length=420.0, width = 20, sliderlength=10, from_=0,to=10,tickinterval=1, resolution=0.1,
- variable = delay, background='#2F343F', fg='white', font='opensans', bd='0', highlightbackground='#2F343F', troughcolor="red")
- Slider_2 = Scale(mGui, orient=HORIZONTAL, length=420.0, width = 20, sliderlength=10, from_=0,to=10,tickinterval=1, resolution=0.1,
- variable = typedelay, background='#2F343F', fg='white', font='opensans', bd='0', highlightbackground='#2F343F', troughcolor="red")
- #image
- image = Image.open('/home/tom/Dokumente/Python/spam.png')
- rimage = image.resize((200,100),Image.ANTIALIAS)
- p = ImageTk.PhotoImage(rimage)
- label_image = Label(mGui, image = p, background='#2F343F')
- #grid
- label_1.grid(row=0, sticky=W)
- label_2.grid(row=2, sticky=W, pady=10)
- label_3.grid(row=3, sticky=W)
- label_4.grid(row=5, column=1, sticky=W, padx=10)
- label_5.grid(row=6, column=1, sticky=W, padx=10)
- label_image.grid(row=7)
- entry_1.grid(row=0, column=1)
- entry_2.grid(row=2, column=1)
- entry_3.grid(row=3, column=1)
- button_1.grid(row=4, column=3)
- checkbutton.grid(row=0, column = 3, sticky=W)
- Slider_1.grid(row = 5)
- Slider_2.grid(row = 6, pady=20)
- mGui.mainloop()
- #---main window end---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement