Aug-14-2023, 02:21 AM
denied() destroys the button. Maybe you want pressing button_1 to call move_button_1()?
import tkinter as tk import random root = tk.Tk() root.geometry("600x600") def move_button_1(): button_1.place( x=random.randint(0, root.winfo_width() - button_1.winfo_width()), y= random.randint(0, root.winfo_height() - button_1.winfo_height()) ) button_1 = tk.Button(root, text='Não', command=move_button_1) button_1.pack() root.mainloop()