Попробуйте так Тест на Pydroid3 from tkinter import *
import pyautogui as pag
class AutoTap(Tk):
def __init__(self):
super().__init__()
self.button = Button(self, text="кнопка")
self.button.config(command=self.signal_handler, width=15)
self.button.pack()
self.label = Label(self)
self.label.pack()
self.auto_tap()
def signal_handler(self):
self.label["text"] = "нажата кнопка{0}".format(str(self.button.winfo_rootx()))
def auto_tap(self):
pag.click(self.button.winfo_rootx()+5, self.button.winfo_rooty()+5)
self.after(5000, self.auto_tap)
app = AutoTap()
app.mainloop()