Installation

Français ici !

Hello!

Here are all the softwares you need to install for the class. The theory is meant to be very short and goes straight to the point. In each chapter of the theory, I ask to read the Base part. There is also a part To know more that is facultative. To give a number on meant to be short, here are the number of A4 pages for each chapter:

theory1 theory2 theory3 Total
Base 2 1 3 6
Total 5 4 8 15

In less than 10 pages, you will have all the necessary theory.

In the extracurricular class, I do the first two chapters of theory for 4 to 6 hours, then we go on the graphical part (make windows !) for the 12 to 14 hours remaining. The chapter number 3 of the theory will be taught to each student depending on his/her advancement in his/her project.

To test a code, you have two options, the first one does not require any installation and the second one lets you install everything you need (mandatory from the 5th session)!

Whether you choose the option 1 or 2, I wish you a Happy Coding and I suggest you to begin the theory number 1!

Option 1: Test online

Test your code online on repl.it pour python3. Vous tappez votre code à gauche, vous faites Run et vous voyez le résultat à droite.

Test your code online on pythontutor. Choose your python version (probably Python 3, otherwhise read the below). and click on execute, the program will run step by step. Click on Next to go forward one line. You can also jump to the end by clicking End.

One example here.

However, as soon as we'll create windows, you'll have to install pygame and therefore do Option 2.

Option 2: Install

You'll have to install

The best is of course to have the last version of python (3.9) but on Windows the installation of pygame is easier for python 3.4.

To install python 3.4 and pygame on Windows, do:

However, to have all the brand new python stuffs, it's better to have more recent versions (3.5, 3.7, 3.9...). Or if you are on mac, it's the same level of difficulty to install 3.9 or 3.4.

Choisir un IDE

You can code using the program IDLE installed by default (press on the windows button to the bottom left of your screen or the search icon on mac and write IDLE). Once IDLE is opened, do File → New, write code, save the file on your desktop, and press F5 (or Run in the menus) to run it.

For another python editor, I recommend PyCharm the Community or Education version is totally free. Or, for a lighter editor Wing IDE 101 or Wing IDE Personal, .

Option 3: Install via pipwin

Avant, pygame était difficilement installable via pip, et donc on devait utiliser pipwin ou les whl... Maintenant c'est facile !

Windows (via pip)

Si jamais dans le futur vous voyez un tutoriel qui vous dit de tapper une commande du style python TRUC, chez vous ça sera py -3 TRUC ou py -2 TRUC si vous devez utiliser python version 2 ou py -3.7 TRUC si vous devez utiliser une version explicite de python, comme 3.7.

Vous pouvez maintenant commencer à coder en choisissant un IDE !

Windows (via pipwin)

Si jamais dans le futur vous voyez un tutoriel qui vous dit de tapper une commande du style python TRUC, chez vous ça sera py -3 TRUC ou py -2 TRUC si vous devez utiliser python version 2 ou py -3.7 TRUC si vous devez utiliser une version explicite de python, comme 3.7.

Si on vous dit d'installer un paquet via pip, par exemple pip install pillow ça sera py -3 -m pipwin install pillow chez vous.

Si la commande précédente ne marche pas, c'est probablement que le package n'est pas disponible via pipwin, regardez l'Option 4.

Vous pouvez maintenant commencer à coder en choisissant un IDE !

Option 4: Install via pip and whl

Cette méthode est plus compliquée que les autres et n'est plus nécessaire depuis que la commande pip install pygame marche sous windows (voir section précédente).

If you have a problem, send me a mail!

Download the last python version (3.7) on python.org.

We're going to use pip which can install any python package! Here we'll install the pygame package to create windows.

A former python version exist: python 2, to know the differences between python 2 and python 3, read the note below.

Windows

Si jamais dans le futur vous voyez un tutoriel qui vous dit de tapper une commande du style python TRUC, chez vous ça sera py -3 TRUC ou py -2 TRUC si vous devez utiliser python version 2 ou py -3.7 TRUC si vous devez utiliser une version explicite de python, comme 3.7.

Si on vous dit d'installer un paquet via pip, par exemple pip install pillow téléchargez le whl sur le site non officiel (pour trouver vite un paquet, utilisez Ctrl+F) et exécutez la commande qu'on vient de faire avec le bon nom de fichier.

Vous pouvez maintenant commencer à coder en choisissant un IDE !

Mac

The instructions come from this page.

Vous pouvez maintenant commencer à coder en choisissant un IDE !

Linux

Follow this.

Note on python versions

If you received a usb key with python, then the version will be 2.7 (former version). The computers at school have a recent python version: 3.5 (new version). For this class, it almost does not change anything, except for these 3 little differences:

Python 2 Python 3
print a,b print(a,b)
7/2 == 3 7/2 == 3.5
Dealing with accents in character strings.

If you have python 2 and want to use some python3 functionalities, add a line like those at the top of the file:


            from __future__ import print_function  # for the print
            from __future__ import division        # for the division
        

For the accents, it's more complicated, but from __future__ import unicode_litterals is a good start.

Opengl / Numpy and other libraries

At the end of the class I'll do an introduction to 3D for those who want to. You'll have to install PyOpenGL and numpy. Those are installed on the computers at school.

If you want to install it at home under Windows, you must install them via with pip and the whl. Except that now you install numpy then PyOpenGL (and PyOpenGL_accelerate if you want to).

The whl for windows are on this unoffical website. To quickly find a package, use Ctrl+F.

For Mac and Linux, a simple pip3 install PyOpenGL PyOpenGL_accelerate numpy will suffice.