Skip to content
This repository was archived by the owner on Sep 7, 2024. It is now read-only.
/ tft-suite Public archive

tft-suite is an active development library for creating and switching between different screens on an Adafruit Mini PiTFT.

Notifications You must be signed in to change notification settings

DrewTChrist/tft-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tft-suite

Description

ARCHIVED

tft-suite is a library for creating and switching between different screens on an Adafruit Mini PiTFT. Adafruit offers these displays in two sizes (135x240) and (240x240). Both of these displays come with two small tactile buttons allowing users to interact with a raspberry pi or the display.

Table of Contents

  1. Installation
  2. Usage
  3. License

Installation

sudo apt-get install ttf-dejavu
python -m pip install git+https://github.com/drewtchrist/tft-suite

Usage

tft-suite offers a small handful of screens that should work right out of the box. Some of the screens have code that has been adapted from AdaFruit's guide here, such as the one that shows stats about the raspberry pi. To use one of the screens that comes with tft-suite, import the Display class and any screens you would like to use like below.

from tft_suite.display import Display
from tft_suite.screens.stats_screen import StatsScreen

if __name__ == '__main__':
    Display((135, 240), [
        (StatsScreen, ())
    ]).start()

Alternatively, anyone can create their own custom Screen class if they'd like to display something that tft-suite doesn't offer! This process should be simplified later on, but the example below should be enough to get someone started.

from tft_suite.screens.screen import Screen

class HelloWorldScreen(Screen):

    def __init__(self, **kwargs):
        super(HelloWorldScreen, self).__init__(**kwargs)

    def draw_screen(self):
        self.draw.rectangle((0, 0, self.width, self.height), outline=0, fill=0)
        self.draw.text((0, 0), "Hello, World!", font=self.font, fill="#FF00FF")
        self.display.image(self.image)

After your screen is created, import it and add it to the list of Screens in your Display class like the first example.

tft-suite gif

When the code is running, screens can be cycled through with either of the two buttons. The backlight can be turned off by quickly pressing both buttons at the same time.

About

tft-suite is an active development library for creating and switching between different screens on an Adafruit Mini PiTFT.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages