Both Thonny and Visual Studio Code are built in to the Raspberry Pi OS. They’re both capable of running Python scripts and useful when you want to make stuff move using the Raspberry Pi. But there can only be one IDE for a Pi user, and this guide should help you choose which to use!
What’s an Integrated Development Environment (IDE)
IDEs are feature-rich programs used to build software with any of the programming languages they support. Modern IDEs come with all the necessary features you need to do something. They boast lints, compilers, interpreters, a view of your folders, and sometimes even a way to upload code to a microcontroller board. They make the whole development process much easier.
Pros/Cons of Thonny
Thonny is an open-source platform that’s dedicated to Python and only Python. It’s an IDE for beginners, mostly because of its easy-to-use GUI.
As soon as you start it up, you can basically just type what you want and save it as if you were using Windows Notepad.
- Easy startup – Thonny opens up quite fast. As soon as it does, you can type code in a new “Untitled” file. This makes it great for writing quick code.
- Has all the basic Python tools – You don’t need to open a new tab or install more software to make Thonny run Python. It’s usable as is.
- Doesn’t have much of a learning curve – It’s easy to find where you could run, pause, and stop Python scripts. Plus, the Shell is quite visible at the bottom.
- No support outside Python – While it’s certainly possible to use it as something like a Notepad to write code in other languages, it can’t run them as you would do with Python. It doesn’t even come with a C compiler!
- No folder tray (built-in explorer) – Unlike most other modern IDEs, Thonny does not show you the folder you are working on.
Pros/Cons of Visual Studio Code
A free and open-source “code editor” by Microsoft, Visual Studio Code can be extended to a full-blown IDE by installing premade extensions. Alternatively, you can make your own extensions and contribute to the growing community of Visual Studio Code extension-makers.
- Multi-language support – Use of Visual Studio Code doesn’t just have to end with Python. You can use most programming languages with it as long as you have the right extensions.
- Allows queuing tasks – If your Raspberry Pi can handle it, you can queue a series of tasks to automate them – like testing your code before uploading to a microcontroller, then opening it up for serial communication.
- User accounts and workspaces – If you are sharing your computer with another developer, it can be easier to access your development setup by logging in to your account or opening your “workspace.” The workspace is your setup on the built-in file explorer, which you can save to allow you to access the same setup at a later time.
- Ease of use – Visual Studio Code is easy to use and comes with plenty of keyboard shortcuts.
- Can be terribly slow – This can be both a user-made problem and a comes-with-the-program one. Visual Studio Code takes much longer to open and does so with zero extensions.
- Running other languages can be slow, too – For one, this is mostly a problem with the Raspberry Pi. If you are used to compiling scripts on a proper laptop or computer, you’ll easily notice the compilation time being much slower while running Visual Studio Code on a Rasbperry Pi. This, however, is not much of a big deal with Python, as it is an interpreted language.
- Confusing at first – With all of the personalization options, using it for the first time as a beginner can be a bit confusing. After all, why would you care about syntax and linters when you haven’t even printed your first “Hello World” yet?
What They Have in Common
While Thonny and Visual Studio Code are two separate entities, they have a lot in common when it comes to functionality. Their overlapping functions are listed below.
Complete Python Support
Both Thonny and Visual Studio code can run, debug, and help you edit Python code. They can also show you where you made a mistake.
Thonny includes an assistant that shows you what you did wrong and where, while the Python extension for Visual Studio Code gives you a run and debugger plus syntax-checking in a single installation.
Python offers a command line interface with the Python Shell. which runs the code you’ve written, and prints out the values in the shell.
Thonny has a terminal that lets users access the shell at the bottom part of the IDE. It’s accessible and you’ll spare no time finding it.
Meanwhile, Visual Studio Code is equipped with the Python extension and won’t show the shell right off the bat. But once you press the “Run” button, it will open the Terminal and go to Windows PowerShell. It works almost the same as the shell in Thonny.
Choosing which IDE to go with really boils down to your specific set of needs. You can narrow the to just four:
- Hardware level programming
- Memory capacity
As the Raspberry Pi can be pretty lacking when it comes to speed and memory capacity, Thonny should be better if you are making memory-intensive projects, but this won’t always be the case. Memory-wise, you may want to use other languages besides Python just to get the most out of its processing speed. Hence, the extra functionality on Visual Studio Code gives it an edge: you can try all the other programming languages with the same thing and see if it makes a difference.
Meanwhile, both can have their own uses when it comes to programming hardware. For one, the Raspberry Pi’s general purpose input output pins can be quickly controlled using Thonny. But for anything else – especially if they don’t use Python – Visual Studio Code will do. In most cases, though, you will be using Thonny when you decide to just try it.
All screenshots by Terenz Jomar Dela Cruz.
Our latest tutorials delivered straight to your inbox