Advertisement
182days

AutoAvailable 1.2 (GUI)

Dec 5th, 2023
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import time
  2. import threading
  3. from tkinter import *
  4. import pyautogui
  5. import random
  6. import keyboard
  7.  
  8. root = Tk()
  9. root.title("Loop Terminate")
  10.  
  11. time.sleep(0.5)
  12.  
  13. stop = False
  14.  
  15. def button_stop_command():
  16.   # If the STOP button is pressed then terminate the loop
  17.   global stop
  18.   stop = True
  19.  
  20. def button_start_command():
  21.   global stop
  22.   stop = False
  23.   time.sleep(2)
  24.   pyautogui.hotkey('win', 'd')
  25.   while True and not stop:
  26.     MouseX = random.randint(0, 1300)
  27.     MouseY = random.randint(0, 700)
  28.     MouseSleep = random.randint(1, 5)
  29.     pyautogui.moveTo(MouseX, MouseY, duration=1)
  30.     pyautogui.click()
  31.     time.sleep(MouseSleep)
  32.    
  33. def button_starter():
  34.   t = threading.Thread(target=button_start_command)
  35.   t.start()
  36.  
  37. # Button START
  38. button_start = Button(root, text="START", padx=30, pady=20, command=button_starter)
  39. button_start.grid(columnspan=1, row=1,column=0)
  40.  
  41. # Button STOP
  42. button_stop = Button(root, text="STOP", padx=33, pady=20, command=button_stop_command)
  43. button_stop.grid(row=2, column=0)
  44.  
  45. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement