problem with passing parameter to the function assigned with the default exit window button in Tkinter, using "root.protocol"
The quick-fix to your problem is quite easy:
Change the line reading root.protocol("WM_DELETE_WINDOW", (lambda event: exit_entry(root)))
into
root.protocol("WM_DELETE_WINDOW", lambda: exit_entry(root))
The root.protocol does not provide an argument when triggered. But your lambda expects one. Removing the argument event
fixes the problem for me.
Please note that there are some other issues with your code.
You are still using Python 2. Unless there are very compelling reasons to do so, I suggest you move forward to Python 3. I had not problems running your code with Python 3. All I needed to do was to add brackets to the print
statement:print "here at exit"
-> print("here at exit")
Secondly: You are using global
in order for your functions to communicate with each other. This is considered bad-practice. It leads to confusing code that is very hard to debug. I suggest that you have a closer look at some tkinter examples and how they are using an object oriented approach to deal with this issue. A possible starting point could be Introduction_to_GUI_Programming. The Calculator class looks like a good starting-point to me.