Friday, 20 October 2017

Just Enough Python

Just Enough Python

This is a series of tutorials to get you going with Python on your Raspberry Pi (or other Linux system) . It is NOT a comprehensive guide to Python but  teaches you enough to be able to give you a flavour of the language and to produce useful programs.

Just Enough Python 0 - getting set up

If you are using a Raspberry Pi to follow this tutorial and you have the latest version of Raspbian, then you already have everything you need. If you are using something else, read this first.

Just Enough Python with Geany 1

Python is a great language to learn, as well as being a real professional's language. It is include in Raspbian the Pi's operation system. Here we see how to use the powerful but light-weight editor, Geany, to create and run a Python program.

Just Enough Python 2

Now we know how to use Geany, we are going to write a simple program that takes and input from the keyboard, changes it a little, and writes back out to the screen. In this simple program we also learn about different types of data and variables. But first we need to tell Geany that we are going to use Python3.

Just Enough Python 3

This time we are going to look at how to make decisions in Python and while weare doing that we'll also see how to use Python libraries.

Just Enough Python 4 - Repeating yourself

This lesson introduces the concept of loops, or repetion, and demonsrates a simple guessing game in Python.

Just Enough Python 5 - Repeating yourself, again

A different type of loop this time which allows us to put a little more sophistication into our guessing game.

Just Enough Python 6 - a simple GUI

We install a very simple GUI package and create a simple windows-like program.

Just Enough Python 7 - buttons and text boxes

We create a GUI for the guessing game and find out how to define a function.

Just Enough Python 8 - a working GUI version of the  guessing game

We use the GUI that we created last time but properly define the function that is invoked when we press a button.

Just Enough Python 9 - a properly working game

We enhance our guessing game with a dialog box and make it work properly. Once you've guessed the right answer it asks you if you want to play again.

Running Python programs on the Raspberry Pi

I've shown you how to create and run programs using Geany but you can run them from the command line, too.  Here's a tutorial on how to do that and, as a bonus, the Idle IDE is introduced, too. (Thanks to Dominic Bolding.)

Intermediate level Python tutorials

For these tutorials we assume a familiarity with Python and the Raspian operating system


Flask is a framework that lets you create dynamic web pages using HTML and Python. While these tutorials are aimed at Raspberry Pi users they are also applicable to Python users on almost any Linux  platform.

Use Flask to put your Pi sensor data on the net - part 1
This tutorial introduces Flask and shows how to create a simple Flask program in Python.

The second part of the tutorial introduces Flask templates and shows how to create a dynamic web page- The example given can be used to display images from a webcam.

No comments:

Post a Comment