Tutorials - Installation tutorial
This tutorial is for people who already installed Python and Pygame. If not, install any version of Python 3 or Python 2.7 (Python download page for beginners) and the corresponding pygame release. If you are completely new with Python, it might be useful to have a look at this page.
ThorPy releases are on PyPi and can be found on https://pypi.python.org/pypi/thorpy/.
The source code and a list of modifications is also published on GitHub at https://github.com/YannThorimbert/Thorpy.
We give here two different way to use ThorPy, each one is cross-platform and independant of your Python version.
Install ThorPy using pip
This method allows you to import ThorPy from Python just as any other package.
- Open a console. Type
pip install thorpy
. That's all. Make sure your version of pip matches the version of Python you plan to use to code your applications with Pygame and Thorpy. - Once the installation is completed, you can open a Python shell and test if ThorPy was successfully installed either by running
python3 testmodule.py
in a console, or by typing the following instruction:from thorpy import testmodule; testmodule.run()
. If a window with some buttons appears, then ThorPy is working.
Download ThorPy as zip file for use/distribution with in a specific project.
Direct extraction
You can use ThorPy without installing it as a python package ; just put the folder at the root of your project.- Download ThorPy from https://github.com/YannThorimbert/Thorpy.
- Extract the thorpy folder anywhere you want in your computer.
- All the scripts which are located in the same folder as thorpy can use ThorPy as if it was installed. Note that this is a way to distribute your scripts.
(optional) Installing dependencies
ThorPy has no other critical dependencies than pygame. However, some graphical effects like shadows and blurs need NumPy and PIL (Python Imaging Library) to work properly. If you do not have these libraries, you can use ThorPy, but without these graphical effects (by the way, see graphics tutorial if you want to make your code safe for people who don't have PIL and NumPy on their computer). You can test if ThorPy is able to produce shadows by checking the value of HAS_NUMPY, HAS_PIL and HAS_SHADOW in the constants module. For instance if thorpy.constants.CAN_SHADOWS:
thorpy.makeup.add_button_shadow(my_button)
.
NumPy can be found on http://www.numpy.org, PIL for python 2.7 on http://www.pythonware.com/products/pil/ and for python 3.x we advise to use Pillow, for which installation instructions can be found on http://pillow.readthedocs.org/installation.html .