# Clicking the button kills the process when run with pythonw.exe # It shows nice error message, when run with python.exe from tkinter import * root = Tk() b = Button(root, text="Kill me", command=lambda *args: 1 / 0) b.grid() root.mainloop()