Reader small image

You're reading from  Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

Product typeBook
Published inSep 2015
Reading LevelBeginner
Publisher
ISBN-139781783551590
Edition1st Edition
Languages
Right arrow
Author (1)
Dan Nixon
Dan Nixon
author image
Dan Nixon

Dan Nixon is a software and electronics engineer living in the north of England. He has past experience of creating software for data analysis, process control, and business intelligence applications. In most of these projects, Python was one of the main languages used. Dan previously authored another book on the uses of the Raspberry Pi, called Raspberry Pi Blueprints, and has worked on many personal projects that use both Python and the Raspberry Pi.
Read more about Dan Nixon

Right arrow

Unit conversion application


Before we can design the command line interface, we need to build up the framework for the unit conversion application. A rough structure of this application is shown in the following UML diagram:

Note

Note that because the unit conversion portion of this application is not the main focus here, not all the code for the unit conversions will be listed. However, they are available with the code download for this chapter.

The UnitTable class contains functions that convert between the units by first converting to a common base unit. To do this, there are two dictionaries with conversion steps for each unit supported by the table: one to convert to from the base unit and one to convert to the base unit.

Additional tables are created by inheriting from the UnitTable class and adding new entries to the to_base_unit and from_base_unit dictionaries. Note that every unit in a unit table must be able to convert to and from the base unit.

We will start by using the existing unit...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)
Published in: Sep 2015Publisher: ISBN-13: 9781783551590

Author (1)

author image
Dan Nixon

Dan Nixon is a software and electronics engineer living in the north of England. He has past experience of creating software for data analysis, process control, and business intelligence applications. In most of these projects, Python was one of the main languages used. Dan previously authored another book on the uses of the Raspberry Pi, called Raspberry Pi Blueprints, and has worked on many personal projects that use both Python and the Raspberry Pi.
Read more about Dan Nixon