The following code produces a window with a button and a menu entry, which both are supposed to exit the application:
from