Linux Format

Thonny 3.3.0

Les Pounder has been tinkering with Python for many years. A recent change of editor revealed a fresh new way to write code.

-

Les Pounder has been tinkering with Python for many years. A recent change of editor revealed a fresh new way to write code.

The default Python editor, IDLE, is a functional means to write Python and for years we suffered it. But then the Raspberry Pi team took a liking to a simpler, friendlier editor, Thonny, created at Estonia’s University of Tartu Institute of Computer Science. Thonny has been part of Raspberry Pi OS for a couple of years now, but the latest release sees support for the new Raspberry Pi Pico microcontr­oller board added as standard. The Raspberry Pi Foundation has supported

Thonny’s developmen­t and it shows how this simple editor has grown in features, but still retained the uncluttere­d user interface.

Thonny comes in three modes. The first is the Simple editor that’s ideal for those taking their first steps in coding. This mode has large buttons and the lack of distractio­ns helps to focus on your code. The next mode is Regular, which provides the same editor as simple, but gives access to menus and advanced features. The final mode is Expert and this mode offers a complete user interface for budding developers.

No matter what mode you pick, the Thonny user interface is a joy. It’s clear and easy to use. We write code in one window, and see the output in the Shell just below. With the View menu we can configure the layout to show exceptions, variables and project files. Running our Python code just needs a press of the Play button, but if we wish to step through our code, line by line, then we have that option. It’s a great tool for debugging!

Add a library or two

Thonny isn’t just about writing code. In the Tools menu we have the Manage Packages option and from here we can install Python libraries directly from the official PYPI repositori­es. Installing via pip isn’t difficult, but managing packages from inside Thonny is a welcome addition that will enable learners to grow in confidence. Thonny also has a plug-in manager that can be used to install libraries from PYPI, via requiremen­ts files (for example Github projects) or we can install libraries from a local drive (for example we installed the pre-release Raspberry Pi Pico backend using this).

Hidden in the Thonny Options menu is the Interprete­r, or more precisely the range of Interprete­rs. From here we can change the Python interprete­r based upon our needs. With the recent release of Raspberry Pi’s first microcontr­oller, the Raspberry Pi Pico and the custom ‘Pi Silicon’ RP2040 SOC, Thonny has been updated with a new interprete­r especially for the Pico when it’s being used with Micropytho­n. Other interprete­rs are available for other Micropytho­n devices such as the BBC micro:bit,. ESP8266, ESP32 and Adafruit Circuitpyt­hon devices. For most Python users it means Thonny can be used to write code for your Pi, Pico, micro:bit and other microcontr­oller devices, so your skills can grow in a familiar editor. What’s more, Thonny isn’t just for the Raspberry Pi – it can also be used with Linux, Mac and Windows machines.

Thonny is the ideal Python editor for new and intermedia­te users. It blends ease of use and a rich feature set into a simple user interface. If you’re keen to tinker with Python and Micropytho­n, then Thonny should certainly be your first choice of IDE. Advanced users will most likely benefit from heavier editors such as Microsoft’s Visual Studio Code or Pycharm, but no matter how advanced your Python skills are, it’s definitely worth giving Thonny a try.

 ??  ?? Hidden under the Tools menu, Options and Manage Packages reveal just how configurab­le Thonny is.
Hidden under the Tools menu, Options and Manage Packages reveal just how configurab­le Thonny is.
 ??  ??
 ??  ?? Thonny works with Python, Micropytho­n and Circuitpyt­hon. No matter the version, it is so simple to use that it belies how powerful it truly is.
Thonny works with Python, Micropytho­n and Circuitpyt­hon. No matter the version, it is so simple to use that it belies how powerful it truly is.

Newspapers in English

Newspapers from Australia