As usual, the main() function is the brains of the program. But it is worthless unless it is called. Here we call the main() function when the application is invoked directly:
if __name__ == "__main__":
main()
By using this way of coding the program, the window is only created when the program is called directly. If, however, another Python program imports the file as a module, the program does not execute but stays secondary to the invoking application's processes. For more on __name__ and calling main(), see "What's in a Name?"
