Advertisement
Jupiter_Crafter

Spam + GUI

Jul 10th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.40 KB | None | 0 0
  1. import pyautogui, time, sys
  2. from tkinter import *
  3. from PIL import Image,ImageTk
  4.  
  5. #counter function
  6. def counter(counter):
  7.  
  8.     counter_text = "|Still", counter, "left|"
  9.     label_counter = Label(mGui, text=counter_text, background='#2F343F', fg='white', font='opensans')
  10.     label_counter.grid(row = 4)
  11.     mGui.update()
  12.  
  13.  
  14. #---main function---
  15. def spam():
  16.    
  17.     input1 = ment.get()
  18.     input2 = ment4.get()
  19.     howmuch = ment2.get()
  20.     lag = ment3.get()
  21.     send_delay = str(delay.get())
  22.     delay_1 = float(send_delay)
  23.     type_delay = str(typedelay.get())
  24.     delay_2 = float(type_delay)
  25.  
  26.     time.sleep(lag)
  27.  
  28.     laenge_eingabe = len(input2)
  29.  
  30.     if laenge_eingabe > 0:
  31.         count = howmuch
  32.         if howmuch == 1:
  33.             counter(count)
  34.             for x in range(int(howmuch), 0, -1):
  35.                 time.sleep(delay_1)
  36.                 pyautogui.typewrite(input1, interval=delay_2)
  37.                 pyautogui.press('enter')
  38.         else:      
  39.             howmuch = howmuch / 2
  40.             for x in range(int(howmuch), 0, -1):
  41.                 counter(count)
  42.                 time.sleep(delay_1)
  43.                 pyautogui.typewrite(input1, interval=delay_2)
  44.                 pyautogui.press('enter')
  45.                 count = count - 1
  46.                 counter(count)
  47.                 time.sleep(delay_1)          
  48.                 pyautogui.typewrite(input2, interval=delay_2)
  49.                 pyautogui.press('enter')
  50.                 count = count - 1
  51.                
  52.     else:
  53.         for x in range(howmuch, 0, -1):
  54.             time.sleep(delay_2)
  55.             counter(x)
  56.             pyautogui.typewrite(input1)
  57.             pyautogui.press('enter')
  58.  
  59.     label_counter = Label(mGui, text="|  Done!  |", background='#2F343F', fg='white', font='opensans')
  60.     label_counter.grid(row = 4)
  61.     mGui.update()
  62. #---main function end---
  63.  
  64.  
  65. #GUI
  66. mGui = Tk()
  67. #entry variables defined
  68. ment = StringVar()
  69. ment2 = IntVar()
  70. ment3 = IntVar()
  71. ment4 = StringVar()
  72. two_or_one = IntVar()
  73. delay = StringVar()
  74. typedelay = StringVar()
  75.  
  76.  
  77. mGui.title("Spam")
  78. mGui.configure(background='#2F343F')
  79.  
  80. #---second send-entry field---
  81.  
  82. def state():
  83.     var = two_or_one.get()
  84.     if var == 1:
  85.         global entry_1_2
  86.         global label_1_2
  87.         entry_1_2 = Entry(mGui, textvariable = ment4, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
  88.         label_1_2 = Label(mGui, text="Spam message 2", background='#2F343F', fg='white', font='opensans')
  89.         label_1_2.grid(row=1, sticky=W, pady = 10)
  90.         entry_1_2.grid(row=1, column=1)
  91.     else:
  92.         entry_1_2.delete(0, END)
  93.         #entry_1_2.insert(0, "")
  94.         entry_1_2.configure(state='readonly')
  95.         #label_1_2.grid_remove()
  96.  
  97.  
  98.  
  99.  
  100. two_or_one = IntVar()
  101.  
  102. #---second entry field end---
  103. #---main window---
  104. label_1 = Label(mGui, text="Spam message", background='#2F343F', fg='white', font='opensans')
  105. label_2 = Label(mGui, text="How often should the message be sent?", background='#2F343F', fg='white', font='opensans')
  106. label_3 = Label(mGui, text="How much time do you need?", background='#2F343F', fg='white', font='opensans')
  107. label_4 = Label(mGui, text="Send Delay", background='#2F343F', fg='white', font='opensans')
  108. label_5 = Label(mGui, text="Type Delay", background='#2F343F', fg='white', font='opensans')
  109.  
  110. checkbutton = Checkbutton(mGui, text = "two messages", variable=two_or_one, background='#2F343F', fg='white', font='opensans',
  111.                             command=state, selectcolor='red', bd='0', highlightbackground='#2F343F')
  112. button_1 = Button(mGui, text = "Spam!", command = spam, background='#2F343F', fg='white', font='opensans', bd='0')
  113.  
  114. entry_1 = Entry(mGui, textvariable = ment, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
  115. entry_2 = Entry(mGui, textvariable = ment2, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
  116. entry_3 = Entry(mGui, textvariable = ment3, background='#2F343F', fg='white', font='opensans', bd='0', highlightcolor='white', insertbackground="white")
  117.  
  118. Slider_1 = Scale(mGui, orient=HORIZONTAL, length=420.0, width = 20, sliderlength=10, from_=0,to=10,tickinterval=1, resolution=0.1,
  119.                     variable = delay, background='#2F343F', fg='white', font='opensans', bd='0', highlightbackground='#2F343F', troughcolor="red")
  120.  
  121. Slider_2 = Scale(mGui, orient=HORIZONTAL, length=420.0, width = 20, sliderlength=10, from_=0,to=10,tickinterval=1, resolution=0.1,
  122.                     variable = typedelay, background='#2F343F', fg='white', font='opensans', bd='0', highlightbackground='#2F343F', troughcolor="red")
  123.  
  124.  
  125. #image
  126. image = Image.open('/home/tom/Dokumente/Python/spam.png')
  127. rimage = image.resize((200,100),Image.ANTIALIAS)
  128. p = ImageTk.PhotoImage(rimage)
  129. label_image = Label(mGui, image = p, background='#2F343F')
  130.  
  131.  
  132. #grid
  133. label_1.grid(row=0, sticky=W)
  134. label_2.grid(row=2, sticky=W, pady=10)
  135. label_3.grid(row=3, sticky=W)
  136. label_4.grid(row=5, column=1, sticky=W, padx=10)
  137. label_5.grid(row=6, column=1, sticky=W, padx=10)
  138. label_image.grid(row=7)
  139.  
  140. entry_1.grid(row=0, column=1)
  141. entry_2.grid(row=2, column=1)
  142. entry_3.grid(row=3, column=1)
  143.  
  144. button_1.grid(row=4, column=3)
  145.  
  146. checkbutton.grid(row=0, column = 3, sticky=W)
  147.  
  148. Slider_1.grid(row = 5)
  149. Slider_2.grid(row = 6, pady=20)
  150.  
  151. mGui.mainloop()
  152. #---main window end---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement