Book Image

Raspberry Pi cookbook for Python programmers

Book Image

Raspberry Pi cookbook for Python programmers

Overview of this book

Table of Contents (18 chapters)
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Tkinter to create graphical user interfaces


We will create a small GUI to allow the user to enter information, and the program can then be used to encrypt and decrypt it.

Getting ready

You will need to ensure that you have completed the instructions in the There's more… section of the Working with text and strings recipe in Chapter 2, Starting with Python Strings, Files, and Menus, where we created the reusable module encryptdecrypt.py. You must ensure that this file is placed in the same directory as the following script.

Note

Since we are using Tkinter (one of many available add-ons of Python), we need to ensure that it is installed. It should be installed by default on the standard Raspbian image. We can confirm it is installed by importing it from the Python prompt, as follows:

python3
>>> import tkinter

If it is not installed, an ImportError exception will be raised, in which case you can install it using the following command (use Ctrl + Z to exit the Python prompt):

sudo...