from tkinter import *
import pyautogui as pag
import random
import time
def perform_action():
x = random.randint(200, 500)
y = random.randint(300, 500)
pag.moveTo(x, y, 0.5)
time.sleep(2)
window = Tk()
window.resizable(width=False, height=False)
window.title("Auto Drag")
window.geometry('140x90')
btn = Button(window, text="START", font='AlBayan 16', command=perform_action)
btn.place(x=36, y=25, width=70, height=40)
window.mainloop()
Окно:
from tkinter import *
window = Tk()
window.resizable(width=False, height=False)
window.title("Auto Drag")
window.geometry('140x90')
btn = Button(window, text="START", font='AlBayan 16')
btn.place(x=36, y=25, width=70, heigh=40)
window.mainloop()
Действие:
import pyautogui as pag
import random
import time
while True:
x = random.randint(200, 500)
y = random.randint(300, 500)
pag.moveTo(x, y, 0.5)
time.sleep(2)