0

The code:

from tkinter import *

class GUI(Tk):
    def __init__(self):
        super().__init__()
        self.protocol("WM_DELETE_WINDOW", self.closing)

    def closing(self):
        self.destroy()

But when closing the window, the program doesn't stop and that's what printed in the console:

while executing "21317232closing" (command for "WM_DELETE_WINDOW" window manager protocol)

What does that mean and is there a way to fix this?

gal
  • 11
  • 1
  • Remove `sys.exit()` and read [Tkinter understanding mainloop](https://stackoverflow.com/a/29158947/7414759) – stovfl May 24 '20 at 21:40

1 Answers1

0

How you are starting this code? I added a couple of lines and it works without errors for me.

from tkinter import *

class GUI(Tk):
    def __init__(self):
        super().__init__()
        self.protocol("WM_DELETE_WINDOW", self.closing)

    def closing(self):
        self.destroy()


app = GUI()
app.mainloop()
jizhihaoSAMA
  • 12,336
  • 9
  • 27
  • 49
Daniel Huckson
  • 1,157
  • 1
  • 13
  • 35