


I’ve named it test, but you can call it whatever you want.Īfter clicking the Save button, the file should get saved with a. As shown in figure 5, it should open the file explorer, where we can choose a location to save the script. An alert box asking to save the file will pop, since we haven’t yet saved the file. Now, to run the script, simply click in the Run menu and select Run Module. Note the Python syntax color highlighting that we get when writing the script on IDLE. You should end with a result similar to figure 3, which shows the previous script written on the editor. You can read more about the Python range function here. It basically prints a “Hello World” message and then has a loop between 0 and 9 where it prints the value of each iteration of the loop.
RASPBERRY PI 3 PYTHON TEXT EDITOR CODE
There we can write our script, which will correspond to the Python instructions we want to run.įor testing purposes, you can use the code below. There, select the New File option, which should open a new text editor window. Then, on the list of tools that will be displayed, choose Python 3 (IDLE), as indicated in figure 1.Īfter the IDE opens, select the File menu on the top left corner, as indicated in figure 2.įigure 2 – Opening the File menu on IDLE. So, to open IDLE, go to the main menu and select Programming. I’m using Python 3.x, but the procedure to run the script on Python 2.x should be similar. Since we are going to use IDLE, the first thing we need to do is opening this IDE. Nonetheless, it should also work with a Python installation on a regular computer. This tutorial was tested on a Raspberry Pi 3 model B+, running version 4.9 of Raspbian, installed using NOOBS.
RASPBERRY PI 3 PYTHON TEXT EDITOR HOW TO
Nonetheless, in this tutorial, we will check how to do it with IDLE, a Python IDE ( Integrated Development Environment). py extension, and can run from the command line. Python scripts can be written in a text file, with a. In this case, we don’t need to manually send the instructions one by one. Thus, the most practical way of running Python code is on a script, which is a sequence of instructions that will be interpreted by the Python interpreter. In this tutorial, we will check how to write Python scripts and run them using IDLE, a Python IDE. Nonetheless, if we want to write larger and more complex programs, it becomes impracticable to send the commands one by one.įurthermore, if some command takes a while to run, it is not feasible to have someone waiting for it to finish to send the next commands. In this tutorial, we will check how to write Python scripts and run them using IDLE.Īs we have seen in the previous tutorials, we can easily run Python commands on a Python interpreter, either on IDLE or on the command line. In this tutorial, we will check how to write Python scripts and run them using IDLE, a Python IDE. This tutorial was tested on a Raspberry Pi 3 model B+, running version 4.9 of Raspbian, installed using NOOBS.
