colorbars.py

../_images/colorbars.jpg

Test bitmap colors.

Displays WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE color bar bitmap named colorbars_{WIDTH}x(HEIGHT) on the display. Custom sized bitmap modules can be created using the make_colorbars_bitmap.py utility.

Note

This example requires the following modules:

  • st7789py

  • tft_config

  • colorbars_{WIDTH}x{HEIGHT}

 1"""
 2.. _colorbars.py:
 3
 4colorbars.py
 5=============
 6
 7.. figure:: ../_static/colorbars.jpg
 8    :align: center
 9
10    Test bitmap colors.
11
12Displays WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE color bar bitmap named
13colorbars_{WIDTH}x(HEIGHT) on the display. Custom sized bitmap modules can be created
14using the :ref:`make_colorbars_bitmap.py<make_colorbars_bitmap>` utility.
15
16.. note:: This example requires the following modules:
17
18  .. hlist::
19    :columns: 3
20
21    - `st7789py`
22    - `tft_config`
23    - `colorbars_{WIDTH}x{HEIGHT}`
24
25"""
26
27import st7789py as st7789
28import tft_config
29
30tft = tft_config.config(tft_config.WIDE)
31mod_name = f"colorbars_{tft.width}x{tft.height}"
32colorbars = __import__(mod_name)
33tft.pbitmap(colorbars, 0, 0)