Python Forum
tkinter.TclError: bad window path name "!button"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter.TclError: bad window path name "!button"
#2
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()
Reply


Messages In This Thread
RE: tkinter.TclError: bad window path name "!button" - by deanhystad - Aug-14-2023, 02:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  add entries and labels to the window tkinter jacksfrustration 3 702 Oct-10-2023, 06:41 PM
Last Post: buran
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 1,985 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  how to open a popup window in tkinter with entry,label and button lunacy90 1 971 Sep-01-2023, 12:07 AM
Last Post: lunacy90
  Tkinter button images not showing up lunacy90 7 1,734 Aug-31-2023, 06:39 PM
Last Post: deanhystad
  tkinter.TclError foxxrunning 10 1,703 Jul-05-2023, 01:48 AM
Last Post: deanhystad
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,219 Jun-13-2022, 08:59 AM
Last Post: Shena76
Sad Selenium: can't open a new window after clicking a button and I don't know why noahverner1995 0 2,020 Jan-22-2022, 09:55 AM
Last Post: noahverner1995
  Closing Threads and the chrome window it spawned from Tkinter close button law 0 1,761 Jan-08-2022, 12:13 PM
Last Post: law
  tkinter auto press button kucingkembar 2 3,279 Dec-24-2021, 01:23 PM
Last Post: kucingkembar
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,259 Sep-09-2021, 01:25 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020