Book Image

Raspberry Pi Blueprints

Book Image

Raspberry Pi Blueprints

Overview of this book

Table of Contents (17 chapters)
Raspberry Pi Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The web application


The web application we will use for the mirror is essentially a framework built using Flask, which provides a common interface for individual widgets displayed on the mirror. In order to get the desired effect where the widgets are visible through the mirror, the page must have a black background with white text and graphics. For best results, the text should be as large as possible so that it allows maximum light to pass through the mirror's surface.

Developing a new widget

Each type of widget that can be shown on the mirror is comprised of four files:

  • A server-side (Python) script file (widgets/CLASSNAME.py)

  • A Jinja-style template file (templates/widgets/CLASSNAME.html)

  • A CSS file (static/widgets/CLASSNAME/style.css)

  • A client-side (JS/jQuery) script file (static/widgets/CLASSNAME/script.js)

Here, CLASSNAME is the class name given to the widget that is used in the widget configuration files to create an instance of the widget on the mirror display. Templates for these files...