Reader small image

You're reading from  Raspberry Pi Essentials

Product typeBook
Published inApr 2015
Publisher
ISBN-139781784396398
Edition1st Edition
Right arrow
Author (1)
Jack Creasey
Jack Creasey
author image
Jack Creasey

Jack Creasey has been in the technology industry for more than 30 years, the last 15 years as a Senior Program Manager in hardware and software design. His expertise includes designing, developing, and teaching IT courseware. He is an avid inventor and holds 13 patents in hardware and software design. After retiring early from the computing industry, Jack avidly participates in social network groups that share his passion for next generation technology solutions.
Read more about Jack Creasey

Right arrow

Project 3 – Creating a simple Python GUI for the security application


We will use a very simple Python application that presents two buttons. One button loads and unloads the raspivid and motion application services, and the second starts and stops recording (irrespective of motion detection).

Python does not have any window-based functionality; it is purely text input by default. To provide a GUI, you have to provide extension libraries and, in this case, we will use a library called tkinter. In the code, we will use tkinter to define the two buttons and will use the OS library to call out to our existing shell script to perform the needed actions.

Perform the following steps to create a Python GUI for your security script:

  1. Install python-tk using the apt-get command.

  2. Create a blank file in /home/pi/camera called buttons.py.

  3. Set the permissions for the file to be executable and ensure the ownership is set to the user pi.

  4. Double-click on IDLE 3 to open the Python development shell and use File...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Raspberry Pi Essentials
Published in: Apr 2015Publisher: ISBN-13: 9781784396398

Author (1)

author image
Jack Creasey

Jack Creasey has been in the technology industry for more than 30 years, the last 15 years as a Senior Program Manager in hardware and software design. His expertise includes designing, developing, and teaching IT courseware. He is an avid inventor and holds 13 patents in hardware and software design. After retiring early from the computing industry, Jack avidly participates in social network groups that share his passion for next generation technology solutions.
Read more about Jack Creasey