use widget.quit() method instead of sys.exit()