Chapter 1: Install VS Code and Python

      

   

If you are taking courses in high school, we recommend using Edupython , which installs everything, all by itself. 😄

But, it may happen that this does not work or, quite simply, that you want to use Microsoft's famous environment: Visual Studio Code . 😀

It may already be installed on your computer (click Windows and type VS Code to check) or it may be available in your application library, in this case, no need to install it from the browser, otherwise, go to the next page , click Download and then install it! 🤪

  

      

Then start the software. The first time it will ask you if you want to configure it by choosing the theme, etc... Do as you want or leave everything as default. 😅

     

   

Now we will install the VS Code Python extension.

Left click on the 5th circled icon, then select Python then Install.

   

   

Next, you need to install the Python software . If you try to open a Python file in VS Code, it will tell you that it can't find a version of Python installed and will redirect you to the Microsoft Store . You can also go there yourself and choose the latest version of Python and install it (3.13 at the time of writing, but it changes quickly!) 😉

Otherwise, if you don't have access to the Microsoft Store, you can download and install Python from the Official Page here.

   

   

   

Open a new document -> Python and type your code to test.

For example:

print("Hello world!")

   

Then click on the arrow at the top right to launch the program.

If it asks you to choose an interpreter , choose Python 3.13 (or other) from the drop-down menu.

The result should then be displayed in the console / terminal below. 😅

      

   

   

  

And there you have it! 😀 Now you are ready to use VS Code to write Python! 😉

   

   

   

Install Pygame

   

While we're at it, let's now install Pygame ! 😀

To do this, go to the Terminal, at the very bottom, and type:

pip install pygame

If it doesn't work, you could try :

py -m pip install pygame

  

   

You can now test with a file from our Pygame mini-tutorial:

   

       

   

Error : File not found with Python and Pygame

      

   If you get this error while attempting to launch the first step in the Pygame Tutorial, it can be because the file loaded (background.png) is not in the right folder (graphics).

   Otherwise, it can also happen, when VSCode tries to launch the program in the default directory which is not the folder of your project.

   To correct that, you can do the following :

  • Open the extensions.
  • Select Python and click on the gear.
  • In the settings, choose Extensions / Python and scroll down.
  • Tick the case: Python: Terminal: Execute in file Dir.

   

   

   Instead of loading a unique file, try also to load the whole folder, it wil be easier to manage your files and your project :

   

   

     

  

Change the language

   

  • Open VScode
  • Press F1 and type 'display'
  • Choose 'Configure display language'
  • Select your language. On top are installed languages, below are other languages. The one you select will be installed as an extension.
  • Accept to restart.
  • You can see that the language you choose has been added to the extensions by selecting 'extension' icon on the left toolbar.

   

   See you soon !  ☺️

   

This site uses cookies to enable you to log in. We do not store or sell any personal data. By continuing to use this website, you agree to their use. Thanks!