0

I have a question, how to detect a button click? I find everywhere a solution (not useful in my opinion)

button = Button(window,command=when_clicked)

I need to detect the closing of the wiget.

button = tk.Button(exit_button, text="Exit", command=new_a_program.destroy)

I thought to use a counter but it doesn't work because it triggers me one step in the module by clicking on the button.

Thank you for your help :

  • Does this answer your question? [How do I handle the window close event in Tkinter?](https://stackoverflow.com/questions/111155/how-do-i-handle-the-window-close-event-in-tkinter) – Ahmed AEK Sep 27 '22 at 08:36
  • I tried on this site to find a solution but I have a problem with it, I have to write such an algorithm: "if I press "Exit" close wigdet and the "Exit" button - I close the widget but I am left with the "Exit" button on the screen. – Luziklolek Sep 27 '22 at 08:42
  • I did, maybe someone will find it useful :D button = tk.Button(self.exit_button, text="Exit", command=self.Close) – Luziklolek Sep 27 '22 at 09:19

0 Answers0