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

4. Operation of the script

This program requires Python 2.5 and Tkinter 8.4. It may work with earlier releases of either.

Command line arguments take this form:

mazeratty NROWS NCOLS [ SEED ]

Number of rows of cells in the maze.


Number of columns of cells in the maze.


Whenever the script creates a maze, the image is annotated by the random number generator seed value that was used to produce that maze. If you would like to reproduce a maze, specify that seed value as the optional third argument.

When you run the program, a window will appear on the screen. Most of the space is taken up by the area where the maze appears. The following controls are arranged along the right side of the window.

# rows

Displays the current number of rows. To change the number of rows, enter the new row count in this field.

# columns

Displays the number of columns. You may also change this value.

Random seed

Displays the random seed used to generate the current maze.

To reproduce a maze with a known random seed, set the correct row and column count in the first two fields, then enter the seed in this field and press the Enter key.

Show the solution

If this checkbox is checked, the solution path through the maze will be shown. Uncheck the box to remove the path from the display.


Click this button to pick a new random seed and regenerate a maze with the currently specified number of rows and columns.


To save the maze as a PDF file, click this button. A file browser dialog will pop up; use this dialog to specify the name and location of the file to be saved.

Note that the saved image will appear exactly as on the screen. If you want a maze without the solution shown, uncheck the Show the solution checkbox before saving.


Click this button to terminate the script.