From 793fc52bd5dbbdecdee8c5452447e47c9c08ff0b Mon Sep 17 00:00:00 2001 From: Adrian Uryga <75134645+Adolsik@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:47:36 +0100 Subject: [PATCH] Release 1.2.0 New Release --- gui.py | 33 +++++++++++++++++++++++++-------- main.py | 15 ++++++++++++--- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/gui.py b/gui.py index 403ec7c..4298163 100644 --- a/gui.py +++ b/gui.py @@ -1,19 +1,36 @@ from tkinter import * import main +import threading +import time + +def stop(event=None): + root.destroy() + +def go(): + t1 = threading.Thread(target=main.go, args=(float(entry_working_time.get()),)) + t1.start() root = Tk() -root.geometry('450x130') +root.geometry('520x160') root.title('Simple AFK BOT') -label_working_time = Label(root, text="Enter how long should bot works (in minutes): ") +label_working_time = Label(root, text="Enter how long should bot works (in seconds): ") label_working_time.grid(row=0, column=0, padx=10, pady=10) entry_working_time = Entry(root) entry_working_time.grid(row=0, column=1, padx=10, pady=10) -button_start = Button(root, text='Start', padx=30, command=lambda: [main.go(float(entry_working_time.get()*60))]) -button_start.grid(row=1, column=1, padx=10, pady=10) +button_start = Button(root, text='Start', padx=30, command=go) +button_start.grid(row=1, column=1, columnspan=2, padx=50, pady=10) + +label_status = Label(root, text=f'Status: {main.status}') +label_status.grid(row=1, column=0, padx=50, pady=10) + +button_quit = Button(root, text="Quit", command=root.destroy, padx=30) +button_quit.grid(row=3, column=1, padx=50, pady=10) + +label_quit = Label(root,text="Press F8 to stop the bot") +label_quit.grid(row=3, column=0, padx=20, pady=10) + +root.bind('',stop) -#TODO -#label_status = Label(root, text=f'Status: BOT IS NOT WORKING') -#label_status.grid(row=2, column=0, padx=50, pady=10) -root.mainloop() \ No newline at end of file +root.mainloop() diff --git a/main.py b/main.py index ecfaf6c..afd4b00 100644 --- a/main.py +++ b/main.py @@ -2,19 +2,28 @@ import time import random +status = "BOT IS NOT WORKING" + def go(working_time): time_delayed = 0.0 + status = "BOT IS WORKING" + # Primary monitor size screen_width, screen_high = pag.size() + while time_delayed <= working_time: + time.sleep(3) + # Mouse move pag.click() x = random.randint(0, screen_width) y = random.randint(0, screen_high) - pag.moveTo(x, y, 0.5) + #pag.moveTo(x, y, 0.5) # Keyboard move - pag.press(['w', 's', 'a', 'd', 'space']) + #pag.press(['w', 's', 'a', 'd', 'space']) + time_delayed += 3 - time.sleep(3) + status = "BOTTING IS DONE" +