2 Software
For this book and seminar, we will need to install
- PsychoPy.
- IDE of your choice. My instructions will be for Visual Studio Code, which has a very good Python support.
- Jupyter Notebook for trying out small snippets of code.
I will not give detailed instructions on how to install the necessary software but rather point you to official manuals. This makes this text more future-proof as specific details might easily change3.
2.1 PsychoPy
If you are using Windows, download and install Standalone PsychoPy version. Use whatever the latest (and greatest) PsychoPy version is suggested to you (PsychoPy 2023.2.2 using Python 3.8 as of time of writing) and follow instructions.
If you are using Mac or Linux, installing PsychoPy via pip or Anaconda are your options. Please follow up-to-date instructions.
2.2 VS Code
Visual Studio Code is a free lightweight open-source editor with strong support for Python. Download the installer for your platform and follow the instructions.
Next, follow Getting Started with Python in VS Code tutorial. If you are using Windows and the standalone PsychoPy installation, skip the Install a Python interpreter section, as you already have Python installation bundled with PsychoPy. This is the interpreter that you should use in the Select a Python interpreter section. In my case the path is C:\Program Files\PsychoPy3\python.exe
.
Install and enable a linter, software that highlights syntactical and stylistic problems in your Python source code. Follow the manual at VS Code website.
2.3 Jupyter Notebooks
Jupyter Notebooks offer a very convenient way to mix text, figure and code in a single document. They also make it easy to play with various small snippets in parallel without running scripts. We will rely on them for our first chapter and for an occasional exercises or code testing later on. There are two way you can use them: 1) in VS Code using Jupyter extension, 2) in your browser using classical interface.
2.3.1 Jupyter Notebooks in VS Code
Follow the manual on how to install Jupyter package and use notebooks in VS Code.
2.3.2 Jupyter Notebooks in Anaconda
The simplest way to use Jupyter Notebooks along with a lot of other useful data science tools is via Anaconda toolkit. However, note that this will introduce a second Python distribution to your system. This, in turn, could lead to some confusion when working with scripts in VS Code if you accidentally have Anaconda interpreter active instead of the PsychoPy one. Do not panic, follow Select a Python interpreter instructions and make sure that you have PsychoPy interpreter as the active one.
Otherwise, download and install Anaconda. The website has an excellent Getting started section.
2.4 Keeping things tidy
Before we start, I suggest that you create a folder called games-with-python (or something along these lines). If you opted to use Jupyter Notebooks via Anaconda, you should create it in your user folder because this is where Anaconda would expects to find them. Then, create a new subfolder for each chapter / game. For the seminar, you would need to zip and upload a folder with all the files.