# Distributing your application on Windows

Creating self-contained applications on Windows is quite straight-forward but you need to make sure than you have all of the correct software installed before you start.

## Python and PyQt

Please ensure that you have installed the following versions of Python and PyQt as it can not be guaranteed that the rest of the instructions will work with earlier or later versions:

We will need to make use of the command prompt to use cx_Freeze therefore Python must be available to us as a command. The following video demonstrates how to add Python to your path.

## Installing cx_Freeze

cx_Freeze is a utility that will take your Python program and convert it to a stand-alone application (.exe) file that can be run on any Windows computer.

If the link is broken try the cx_Freeze homepage:

## Creating a script for cx_Freeze

To create a stand-alone application from your program cx_Freeze needs a script to tell it what to do. Because our programs are fairly simple (in the grand scheme of things) all we need to do is make a few changes to the sample program that is provided by cx_Freeze for use with PyQt programs.

The sample script has two lines that we are interested in:

1. application_title = "simple_PyQt4"
2. main_python_file = "PyQt4app.py"

You should change the values assigned to the variables application_title and main_python_file so that they are suitable for whatever program you wish to create a stand-alone application for. For example, the field simulation would be:

1. application_title = "Field Simulation"
2. main_python_file = "field_simulation.py"

Once you have made the necessary changes save the script and then move it so that it is in the same directory as the Python modules you want to convert to a stand-alone application.

## Run the cx_Freeze script

The final step of this process is to execute the cx_Freeze script. The video demonstrates how to do this.