Skip to content

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
Adolsik authored Nov 8, 2022
1 parent dcfdef1 commit 793fc52
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
33 changes: 25 additions & 8 deletions gui.py
Original file line number Diff line number Diff line change
@@ -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('<F8>',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()
root.mainloop()
15 changes: 12 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 793fc52

Please sign in to comment.