|
| 1 | +import tkinter as tk |
| 2 | +from tkinter import messagebox as msg |
| 3 | +from pyautogui import write, press |
| 4 | +from time import time, sleep |
| 5 | + |
| 6 | + |
| 7 | +def start(time_sleep, content, times, delay): |
| 8 | + sleep(time_sleep) |
| 9 | + first_time = time() |
| 10 | + for i in range(times): |
| 11 | + write(content) |
| 12 | + press("enter") |
| 13 | + sleep(delay) |
| 14 | + print("Done") |
| 15 | + final_time = time() - first_time |
| 16 | + msg.showinfo("DONE!", f"Done!\nIt took {round(final_time,2)} seconds to write {content} {times} times!") |
| 17 | + print(f"Done!\nIt took {final_time} seconds to write {content} {times} times!") |
| 18 | + |
| 19 | + |
| 20 | +if __name__ == "__main__": |
| 21 | + # Main Window |
| 22 | + print("Launching..") |
| 23 | + root = tk.Tk() |
| 24 | + root.geometry("500x410+50+50") |
| 25 | + root.resizable(False, False) |
| 26 | + root.title("Spam-Bot") |
| 27 | + root.config(bg="black") |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + # Entries |
| 32 | + e1 = tk.Entry(root) |
| 33 | + e1.place(x=180, y=120, width=300) |
| 34 | + e2 = tk.Entry(root) |
| 35 | + e2.place(x=180, y=160, width=300) |
| 36 | + e3 = tk.Entry(root) |
| 37 | + e3.place(x=180, y=200, width=300) |
| 38 | + e4_value = tk.StringVar(value="0") |
| 39 | + e4 = tk.Entry(root, textvariable=e4_value) |
| 40 | + e4.place(x=180, y=240, width=300) |
| 41 | + |
| 42 | + # Labels |
| 43 | + l1 = tk.Label(root, text="Content:", font=("Arial", 20), bg="black", fg="white") |
| 44 | + l1.place(x=10, y=120) |
| 45 | + l2 = tk.Label(root, text="How often:", font=("Arial", 20), bg="black", fg="white") |
| 46 | + l2.place(x=10, y=160) |
| 47 | + l3 = tk.Label(root, text="Start delay:", font=("Arial", 20), bg="black", fg="white") |
| 48 | + l3.place(x=10, y=200) |
| 49 | + l4 = tk.Label(root, text="Delay:", font=("Arial", 20), bg="black", fg="white") |
| 50 | + l4.place(x=10, y=240) |
| 51 | + main_text = tk.Label(root, text="A completely normal", font=("Arial", 30), bg="black", fg="white") |
| 52 | + main_text.place(x=50, y=0) |
| 53 | + main_text2 = tk.Label(root, text="Spam-Bot", font=("Arial bold", 40), bg="black", fg="white") |
| 54 | + main_text2.place(x=130, y=50) |
| 55 | + |
| 56 | + # Start with parameters |
| 57 | + def start_local(): |
| 58 | + try: |
| 59 | + start(int(e3.get()), e1.get(), int(e2.get()), int(e4.get())) |
| 60 | + except ValueError: |
| 61 | + print("Not all values are integers!") |
| 62 | + msg.showwarning("FATAL VALUE ERROR", "FATAL ERROR!\nNot all text fields are filled with integers!") |
| 63 | + |
| 64 | + |
| 65 | + # Buttons |
| 66 | + start_button = tk.Button(root, text="Start", fg="green", bg="white", height=2, width=6, font=("Arial Bold", 40), |
| 67 | + command=start_local) |
| 68 | + start_button.place(x=150, y=290) |
| 69 | + |
| 70 | + root.mainloop() |
0 commit comments