PyCharm (graduation track)
PyCharm is a fully equipped IDE from JetBrains. You don’t need it to get going with Pgzero or Pygame, but if you want to grow further as a programmer it’s a handy step. Think of a built-in debugger, smart code completion and powerful refactoring tools.
When to switch?
Just keep working with Thonny as long as that feels fine. Only consider PyCharm once you:
- want to inspect variables while your code is paused (debugger),
- want to quickly rename functions or variables across your whole project (refactoring), or
- want autocomplete that also knows the types of your variables.
For beginners and most dojo sessions, Thonny is more than enough.
Installing PyCharm Community
Download the free Community edition at jetbrains.com/pycharm. Choose Community, not Professional. Professional is paid and you don’t need it.
- Go to the download page and click Community-Free.
- Run the installer and leave all the default settings as they are.
- Start PyCharm. You don’t have to create a JetBrains account.
Creating a new project and setting up the interpreter
When you start PyCharm for the first time, you choose New Project.
PyCharm 2024.1 or newer with uv:
If you already have uv on your system (see the Thonny guide), PyCharm recognises it automatically. Under Python version, choose 3.13, 3.14 or 3.15 and let PyCharm create a uv environment.
Older version, or without uv using venv:
- As Interpreter type, choose Virtualenv.
- Under Base interpreter, select the Python installation on your system (usually
python3orpython3.x). - Leave the Create a main.py welcome script checkbox on or turn it off. It doesn’t matter.
Then click Create. PyCharm creates the environment and opens the project.
Installing packages
You install pgzero, pygame-ce and pygbag through the settings:
- Open File → Settings (on macOS: PyCharm → Preferences).
- Navigate to Project: <naam> → Python Interpreter.
- Click the + icon at the bottom right.
- In the search box, search for
pgzeroand click Install Package. Do the same forpygame-ceandpygbag. - Close the window when all three are done.
Check that it all worked: on the right in the list you now see pgzero, pygame-ce and pygbag with their version numbers.
Note
Doesn’t the Install Package button for pgzero work on Python 3.14 or 3.15? That’s because pgzero pulls in the classic pygame. In that case use the built-in terminal with uv add pgzero pygame-ce and put [tool.uv] exclude-dependencies = ["pygame"] in your pyproject.toml. See also Installing Thonny + Pgzero.
Run config for Pgzero
Pgzero works differently from a normal Python script: you start it as a module and pass your file name as an argument.
- At the top, click Add Configuration… (or open Run → Edit Configurations…).
- Click the + icon and choose Python.
- Fill in:
- Name:
Pgzero - Run: set the choice to Module name (not Script path)
- Module name:
pgzero - Parameters:
main.py - Working directory: the folder of your project (if it is still empty, click the folder icon and choose your project folder)
- Name:
- Click OK.
Then select the Pgzero configuration in the dropdown menu at the top and press the green play button to start your game.
Run config for Pygame
Pygame you do start as a normal script:
- Open Run → Edit Configurations… again and click + → Python.
- Fill in:
- Name:
Pygame - Run: leave the choice on Script path
- Script path: browse to
main.pyin your project folder - Working directory: your project folder
- Name:
- Click OK.
Choose the Pygame configuration in the dropdown menu and press the play button.
That’s all. You now have two ready-made run configurations: one for Pgzero games and one for Pygame games. Just switch configuration in the dropdown menu at the top, depending on what you’re building.
Handy tips
- Using the debugger: Set a breakpoint by clicking to the left of a line number (red dot). Then start your run configuration with the bug button instead of the play button. PyCharm pauses on that line so you can look at your variables.
- Automatic imports: If PyCharm puts a red underline under a name you just wrote, press Alt+Enter to automatically add the right
importstatement at the top. - Terminal: At the bottom you can open a built-in terminal (View → Tool Windows → Terminal). Handy for
uv addor for runningpygbagto publish.