Next / Previous / Contents / TCC Help System / NM Tech homepage

10. main(): The main program

There is not much for the main program to do except to instantiate the Tkinter application, decorate its frame with the application's title, and enter the Tkinter main loop. However, we must first increase Python's recursion limit, because the recursive algorithm in Section 12.8, “Maze.__exitCheck(): Is there an open route to the goal from this cell?” can recur quite deeply. See the documentation for the sys module for details.

mazeratty
# - - - - -   m a i n


def main():
    """Main program.

      [ if the command line arguments are valid ->
          display a Tkinter application that generates a maze
        else ->
          sys.stderr  +:=  error message(s) ]
    """
    sys.setrecursionlimit(100000)  # Allow deep recursion
    app = App()
    app.master.title("mazeratty")
    app.mainloop()