# CircuitPython Display_Text Library

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/100/522/medium800/lcds___displays_e830jkhp.gif?1615305594)

The [Adafruit\_CircuitPython\_Display\_Text](https://github.com/adafruit/Adafruit_CircuitPython_Display_Text) library allows you to easily add text to your `displayio` based CircuitPython projects. If you have no prior experience with `displayio`, you should check out the [Displayio Basics Guide](https://learn.adafruit.com/circuitpython-display-support-using-displayio) first to learn the basic concepts.

This guide will show you how to install the library and go over all of the features and what they do.

### Other Helpful Resources

- [Display\_Text docs page](https://circuitpython.readthedocs.io/projects/display_text/en/latest/)
- [Repository Example scripts](https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/tree/master/examples)
- [Example scripts from this guide](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/CircuitPython_Display_Text)
- [Bitmap\_Font library](https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font)

## Parts

Here are some displays that work well with CircuitPython and the displayio library:

### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **PyPortal** , our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
![Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display. ](https://cdn-shop.adafruit.com/640x480/4116-00.jpeg)

### Adafruit MagTag - 2.9" Grayscale E-Ink WiFi Display

[Adafruit MagTag - 2.9" Grayscale E-Ink WiFi Display](https://www.adafruit.com/product/4800)
The Adafruit MagTag combines the ESP32-S2 wireless module and a 2.9" grayscale E-Ink display to make a low-power IoT display that can show data on its screen even when power is removed! The ESP32-S2 is great because it builds on the years of code and support for the ESP32 and also adds...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4800)
[Related Guides to the Product](https://learn.adafruit.com/products/4800/guides)
![Angled shot of rectangle-shaped electronic ink display breakout with the text: "MAGTAG 2025 Edition with SSD1680 Chipset"](https://cdn-shop.adafruit.com/640x480/4800-10.jpg)

### PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen

[PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen](https://www.adafruit.com/product/2298)
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a resistive&nbsp;touch overlay. The plate uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2298)
[Related Guides to the Product](https://learn.adafruit.com/products/2298/guides)
![Red polished white finger touching the PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen. ](https://cdn-shop.adafruit.com/640x480/2298-16.jpg)

### Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers

[Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers](https://www.adafruit.com/product/3651)
Spice up your Feather project with a beautiful 3.5" touchscreen display shield with built in microSD card socket. This TFT display is 3.5" diagonal with a bright 6 white-LED backlight. You get a massive 480x320 pixels with individual 16-bit color pixel control. It has way more...

In Stock
[Buy Now](https://www.adafruit.com/product/3651)
[Related Guides to the Product](https://learn.adafruit.com/products/3651/guides)
![Overhead shot of a Black woman's hands with a blue and pinkish-red manicure drawing a heart on a touchscreen breakout.](https://cdn-shop.adafruit.com/640x480/3651-05.jpg)

### TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers

[TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers](https://www.adafruit.com/product/3315)
A Feather board without ambition is a Feather board without FeatherWings! Spice up your Feather project with a beautiful 2.4" touchscreen display shield with built in microSD card socket. This TFT display is 2.4" diagonal with a bright 4 white-LED backlight. You get&nbsp; 240x320...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3315)
[Related Guides to the Product](https://learn.adafruit.com/products/3315/guides)
![View of a TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers. A polished finger drawing a heart on the touch screen. ](https://cdn-shop.adafruit.com/product-videos/640x480/3315-09.jpg)

# CircuitPython Display_Text Library

## Setup

You should install the latest version of CircuitPython for your device as well as the newest versions of the libraries which will be used.

## CircuitPython

The topics covered in this guide apply to many different devices. [Follow the instructions here](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython) to get the newest version of for your device. Find the latest version for your device at [circuitpython.org/downloads](https://circuitpython.org/downloads).

## Libraries
Next you'll need to install the required libraries. [Download the latest library bundle](https://circuitpython.org/libraries) and then copy them into the **lib** folder on your device. This guide will be focusing on these two:

- **adafruit\_display\_text**
- **adafruit\_bitmap\_font**

You may have other libraries present on your device, but you must have at least these two.

![lcds___displays_libraries.png](https://cdn-learn.adafruit.com/assets/assets/000/100/431/medium640/lcds___displays_libraries.png?1615152387)

# CircuitPython Display_Text Library

## Types of Labels

The adafruit\_display\_text library currently has two different types of label functions in it. This guide goes over those label functions and the differences between them. If you are less concerned about the details and just want to know which to use for your new project, go with [BitmapLabel](https://learn.adafruit.com/circuitpython-display_text-library/types-of-labels#bitmaplabel-3084168-6).

# Label
Warning: 

This is the original Label class. Each glyph within the text is stored in its own Bitmap and TileGrid objects, and those all get put into a single Group object. In prior versions of CircuitPython there was a parameter `max_glyphs` that enforced a limitation in the underlying Group that limited the number of items in the Group. In CircuitPython 7.0.0 this limitation has been removed from Group and therefore also no longer applies to Label.

![](https://cdn-learn.adafruit.com/assets/assets/000/099/719/medium800/lcds___displays_Label_objects_diagram.png?1614125895)

If you set a `background_color`, then the background will get its own TileGrid and Bitmap as well. The diagram above depicts a Label with no background Bitmap in it.

# BitmapLabel

This is a newer class that was introduced more recently after many features were added into the original Label class. In the BitmapLabel, all of the glyphs are stored inside of a single Bitmap and TileGrid. This tends to result in lower memory usage, especially for long strings.

![](https://cdn-learn.adafruit.com/assets/assets/000/100/521/medium800/lcds___displays_otcqz3iy.gif?1615305481)

Warning: 

BitmapLabel typically will use a little bit less RAM -- it can be helpful sometimes in larger projects to switch from Label to BitmapLabel to save more RAM for your projects other needs.

## OutlinedLabel

Starting with the release version [**3.1.0** the Adafruit\_Display\_Text](https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/releases/tag/3.1.0) Library supports an `OutlinedLabel` which lets you make text with an outline stroke of a specified size and color.

Here is a screenshot of an `OutlinedLabel` with pink text `color` and green `outline_color`. The code below is an example of this.

![lcds___displays_outlined_label_screenshot.png](https://cdn-learn.adafruit.com/assets/assets/000/129/077/medium640/lcds___displays_outlined_label_screenshot.png?1711814873)

```python
text_area = OutlinedLabel(
    terminalio.FONT,
    text="Outlined\nLabel",
    color=0xFF00FF,
    outline_color=0x00FF00,
    outline_size=1,
    scale=5,
)
```

## Scrolling Label

Starting with the release version [**2.22.0** the Adafruit\_Display\_Text](https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/releases/tag/2.22.0) library supports `ScrollingLabel`. The `ScrollingLabel` class is a label that can have a specified maximum number of characters showing at a time and will scroll through a larger message, like a marquee.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/078/medium800/lcds___displays_scrolling_label_screenrecord-ezgif.com-optimize.gif?1711816850)

The ScrollingLabel depicted above is initialized with the following code:

```auto
text = "Hello world CircuitPython scrolling label"
my_scrolling_label = ScrollingLabel(
    terminalio.FONT, 
    text=text, 
    max_characters=20, 
    animate_time=0.1, 
    scale=2
)
while True:
    my_scrolling_label.update()
```

# Advanced Color Masking&nbsp;
BitmapLabel can be used with&nbsp;`None`&nbsp;value for&nbsp;`color` and any opaque value for `background_color` to produce a transparent "cutout" of the text in the label. You can put rainbows or other interesting things in the background, and layer the BitmapLabel on top to produce fancy text graphics. [See the example here](https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CircuitPython_Display_Text/colormask_example/code.py).

![lcds___displays_display_text_rainbow_colormask.png](https://cdn-learn.adafruit.com/assets/assets/000/099/959/medium640/lcds___displays_display_text_rainbow_colormask.png?1614642397)

# CircuitPython Display_Text Library

## Label Placement

There are a few different ways to place your text with display\_text labels. All of these settings are available for both Label and BitmapLabel.

# x, y coordinates

&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/099/833/medium800/lcds___displays_display_text_x_y_coordinates.png?1614524936)

The label can be placed using x, y coordinates. The default origin is located on the far left horizontally, and half the height vertically as shown in the image above.

# Baseline Alignment

The&nbsp;`base_alignment` parameter can be set to `True` to change the vertical origin to point to the baseline of the text. This is helpful for lining up fonts of different sizes nicely next to each other. The default value is `False`.

![lcds___displays_base_alignment.png](https://cdn-learn.adafruit.com/assets/assets/000/099/834/medium640/lcds___displays_base_alignment.png?1614526337)

# Descenders

Many fonts have glyphs with descenders that drop down below the baseline. This image illustrates some of them:

![](https://cdn-learn.adafruit.com/assets/assets/000/099/838/medium800/lcds___displays_display_text_decender_illustration.png?1614529038)

Not all fonts use all of the same descenders on their glyphs. So your font may look different, but the concept should work the same for any that it does have. This example shows 'y' glyphs descending below the baseline and the effect of the `base_alignment` parameter on them.

![lcds___displays_display_text_decender_baseline.png](https://cdn-learn.adafruit.com/assets/assets/000/099/852/medium640/lcds___displays_display_text_decender_baseline.png?1614555810)

# Anchored Positioning

If you'd like more precise control over the placement of your text, you can use `anchor_point` and `anchored_position` instead of `x` and `y` coordinates. With this method, you can set the origin point anywhere you want within your Label. It's particularly useful for centering text within the display, or aligning it to the right edge of the display.

![](https://cdn-learn.adafruit.com/assets/assets/000/099/836/medium800/lcds___displays_display_text_anchor_point.png?1614527807)

`anchor_point` is a tuple containing two float values. This is the point that your Label will get positioned relative to. `0.0` being left and top, and `1.0` being right and bottom with values between representing their location within the rectangle that makes up your label. The default is `(0.0, 0.0)` which is the top left corner.

# Anchored Position

When you set the&nbsp;`anchored_position`,&nbsp;the label will move so that its&nbsp;`anchor_point`&nbsp;is aligned on top of the coordinates that you set for the&nbsp;`anchored_position`. The value is a tuple containing two integers that represent pixel coordinates on the display. There is a similar example in [the library repository](https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/master/examples/display_text_anchored_position.py).

![lcds___displays_display_text_anchored_position.png](https://cdn-learn.adafruit.com/assets/assets/000/099/837/medium640/lcds___displays_display_text_anchored_position.png?1614528529)

# CircuitPython Display_Text Library

## Label Appearance

There are many parameters and properties you can use to control the way your text looks. This page will list them and show examples of each. All of these settings may be used on both BitmapLabel and Label.

# Font

The `font` parameter is used to set the typeface for your text. The default value is `terminalio.FONT`, which is the built-in font for the system. Different builds of CircuitPython can have different built-in fonts, though many of them have the same one. Blinka\_Displayio has a built-in font as well. You can load custom font files from pcf and bdf font files using the adafruit\_circuitpython\_bitmap\_font library.

![lcds___displays_display_text_font.png](https://cdn-learn.adafruit.com/assets/assets/000/099/832/medium640/lcds___displays_display_text_font.png?1614524418)

# Scale

The `scale` parameter is inherited from Group. It can be used to make the label bigger. The default value is `1`. Set it to a larger integer to make the text bigger by that scale factor.

![lcds___displays_display_text_scale.png](https://cdn-learn.adafruit.com/assets/assets/000/099/788/medium640/lcds___displays_display_text_scale.png?1614389121)

# Color

`color` is an optional parameter and property that controls the color of your text. The value should be a hex color value, and the default is `0xFFFFFF` or white.

![lcds___displays_display_text_color.png](https://cdn-learn.adafruit.com/assets/assets/000/099/772/medium640/lcds___displays_display_text_color.png?1614305060)

# Background Color

The optional parameter and property `background_color` will cause a background box to be drawn containing your text. The default is `None`, which causes no background to be drawn. Set it to a color hex value to enable, i.e. `0xFF00FF`.

![lcds___displays_display_text_background_color.png](https://cdn-learn.adafruit.com/assets/assets/000/099/773/medium640/lcds___displays_display_text_background_color.png?1614305416)

# Padding

There are 4 parameters that can be used to adding padding to the insides of your label: `padding_top`, `padding_bottom`, `padding_left`, and `padding_right`. You can use any single one, or any combination of them.

![lcds___displays_display_text_padding.png](https://cdn-learn.adafruit.com/assets/assets/000/099/786/medium640/lcds___displays_display_text_padding.png?1614383115)

# Background Tight

The&nbsp;`background_tight`&nbsp;parameter specifies that you want the background box to be drawn as small or tight as possible. When this is set to&nbsp;`True`, the padding values will be ignored. Also, if there are no glyphs used with descender sections, then the background won't include space for them. The default value is `False`, which will include space for the descender even if your text does not have any of them.

![lcds___displays_display_text_background_tight_v2.png](https://cdn-learn.adafruit.com/assets/assets/000/099/784/medium640/lcds___displays_display_text_background_tight_v2.png?1614382409)

# Line Spacing

The optional&nbsp;`line_spacing`&nbsp;parameter and matching property are used to specify how much space should appear between different lines of text. You can use&nbsp;`"\n"`&nbsp;in your text to make a new line. The default value is&nbsp;`1.25`, which looks pretty good with the built-in font. You can go smaller to pack the lines closer, or bigger to add some extra blank room between lines.

![lcds___displays_display_text_line_spacing.png](https://cdn-learn.adafruit.com/assets/assets/000/099/787/medium640/lcds___displays_display_text_line_spacing.png?1614384038)

# CircuitPython Display_Text Library

## Advanced Font Customization

Custom fonts are achieved with the [Adafruit\_Circuitpython\_Bitmap\_Font](https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font) library. There are two types of custom font files supported: `pcf` and `bdf`. You can find font files online and use converters to get them to the correct formats for use with display text labels. This guide covers the process:

[Custom Fonts for CircuitPython Display](https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display)
![](https://cdn-learn.adafruit.com/assets/assets/000/099/839/medium800/lcds___displays_display_text_fonts_embed_thumbnail.jpg?1614537163)

# CircuitPython Display_Text Library

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/071/369/medium800/circuitpython_hero-desk.jpg?1550448667)

## More Fonts

Are you looking to display new fonts on your PyPortal? You can use just about any font on your computer or downloaded from the internet. This guide will walk you through generating bitmap fonts using the [FontForge open-source](https://fontforge.github.io) project.

## Why Bitmaps?

PyPortal uses the [CircuitPython Bitmap Font Library](https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font/) to render "live" text on the display.&nbsp;A bitmap font stores each character as an array of pixels. Bitmap fonts are simply groups of images. For each variant of the font, there is a complete set of images, with each set containing an image for each character.

Computers, on the other hand, use variable size 'TrueType' or 'Postscript' fonts, where there's a mathematical algorithm that defines each character, so it can be drawn at _any_ size.

## Font Forging

This is where FontForge comes into play. FontForge is an open-source font editor for Windows, Mac OS and GNU+Linux. It features tools for converting existing fonts into different font formats.

## Getting Started with FontForge

Head on over to the [fontforge page](https://fontforge.github.io/en-US/) and download the app for your platform. You can choose to donate, subscribe via email or simply click the " **Subscribe/Confirm and Download**" button (no need to enter an email).&nbsp; Follow along with the detailed installation guide to get setup with FontForge.

![circuitpython_hero-fontforge.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/359/medium640/circuitpython_hero-fontforge.jpg?1550439781)

[Download FontForge](https://fontforge.github.io/en-US/downloads/)
## Where Do I Get Fonts?

Here's a list of some neat places to obtain some fresh fonts.

- [The Inter typeface family](https://rsms.me/inter/)
- [Font Squirrel](https://www.fontsquirrel.com/)
- [Google Fonts](https://fonts.google.com/)
- [Adobe Fonts](https://fonts.adobe.com/)
- [DaFont](https://www.dafont.com/)
- [Font Library](https://fontlibrary.org/)

# CircuitPython Display_Text Library

## Use FontForge

![](https://cdn-learn.adafruit.com/assets/assets/000/071/367/medium800/circuitpython_hero-fontforge.jpg?1550448607)

## Demo Walkthrough

In this example, we're going to convert a **.TTF** (TrueType Format) into a **.BDF** (Bitmap Distribution Format). I'm using an open licensed font downloaded from Google Font,&nbsp;[Source Serif Pro](https://fonts.google.com/specimen/Source+Serif+Pro).&nbsp;

## Open Font

Use the **file** menu and choose **Open Font** from the list. Navigate to a directory where your desired font resides. Select the font and open it.

![circuitpython_open-font.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/361/medium640/circuitpython_open-font.jpg?1550446525)

## Set Font Size

From the **element** menu, select **Bitmap Strikes Available**. In this dialog, you will need to specific how large you want your font to be. The font size is fixed with Bitmap fonts, so if you want to use different sizes, you'll need to make separate files.

![circuitpython_bitmap-strike-available.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/362/medium640/circuitpython_bitmap-strike-available.jpg?1550447371)

## Generate Bits

From the **element** menu, select **Regenerate Bitmap Glyphs**. Similar to the previous dialog, enter the font size of your liking. You can make it smaller here. Be aware, values too small will not generate BDF's.&nbsp;

![circuitpython_regenerate-bitmap.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/363/medium640/circuitpython_regenerate-bitmap.jpg?1550447555)

## Export Converted Font

From the **file** menu, select **Generate Fonts**. In the dialog, select **No Outline Font** and **BDF** from the dropdown options. Use the navigation UI to save the file in your directory of choice. Click the **generate** button to save the file.&nbsp;

![circuitpython_generate-font.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/364/medium640/circuitpython_generate-font.jpg?1550447833)

## BDF Resolution

This dialog menu will pop up after clicking generate. You can choose one of the options from the list. If you'd like a different font size, you can enter that in the **Other** labeled input box. Click **OK** to save it!

![circuitpython_bdf-resolution.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/365/medium640/circuitpython_bdf-resolution.jpg?1550447953)

## Optimize File Size

If you take a look at the file size of the .bdf, it's roughly around 900K – That can be a bit larger than needed, especially if you plan to store a lot of image and sound assets. In cases where you need to save on every byte, you can optimize the file size of your fonts by selecting only the characters you want to use. If you scroll through the full list of glyphs, you'll see there's extra special characters – A whole bunch of them! If you don't need them in your project, just select "space" (the glyph just before "!") plus the basic set of upper/lower and alphanumeric characters. You can click + hold and drag to make selections easier. With them selected, go through these steps:

1. Select the glyphs you want to keep
2. Use **Edit→Select→Invert Selection** to change the selection to the _unwanted_ glyphs.
3. Use **Encoding→Detach & Remove Glyphs...** to remove the unwanted glyphs. (You'll have to re-load your original font file to undo this step)
4. Use **Element→Regenerate Bitmap** to reprocess the glyphs.
5. Use **File→Generate Font** to save the reduced version of the file

![circuitpython_selected-glyphs.jpg](https://cdn-learn.adafruit.com/assets/assets/000/071/366/medium640/circuitpython_selected-glyphs.jpg?1550448080)

Primary: 

Make sure your final font contains the letter capital **M** , which is used to estimate the height of letters in the font. Otherwise, the font will be incompatible with **adafruit\_display\_text** and give an error like `AttributeError: 'NoneType' object has no attribute 'height'`

## Optimize File Size (Manually)

If you prefer, you can also use a text editor to remove glyphs from a **.bdf** file. BDF files are just text!

Open a BDF file and search for “ **asciitilde** ” — this is usually the highest plain-ASCII-value glyph we want to preserve. A few lines down there will be an “ **ENDCHAR** ” line.

Delete everything after the **ENDCHAR** line, then add a line containing&nbsp; **ENDFONT**. That’s it! Save the file, which is usually just a small fraction of the original size.

You won’t get any accented characters or special punctuation this way, so it’s not always the right thing for every situation. For the majority of plain-text programs though, this can really help stretch your CIRCUITPY drive space!

![circuitpython_fontforge-edit.png](https://cdn-learn.adafruit.com/assets/assets/000/097/160/medium640/circuitpython_fontforge-edit.png?1605820922)

## Font Colors

The color of the fonts can be setup in your code. The CircuitPython library uses HEX color codes. This is similar to web color pickers but formatted slightly different. Most HEX color pickers use a hashtag in the front of the value, like, **#000000**. In CircuitPython, instead of a hashtag, **0x** &nbsp;is used. Here's a few examples.

- Black =&nbsp; 0x000000
- White = 0xFFFFFF
- Purple = 0x8f42f4

# CircuitPython Display_Text Library

## Convert to PCF

CircuitPython supports two font formats: the textual **.bdf** format and the binary **.pcf** format. By taking the extra step of converting your font to **.pcf** you make fonts load faster and also typically save some storage space on the board **CIRCUITPY** flash drive.

The converter software is hosted on github.io. Thanks to technology called [emscripten](https://emscripten.org/), it runs entirely in your web browser—the font file is not uploaded to a server, which also makes it really quick. web-bdftopcf is derived from the classic font converter of the same name, a program for Unix/Linux systems. If you're interested, you can [browse the C source on github](https://github.com/adafruit/web-bdftopcf).

Head to [https://adafruit.github.io/web-bdftopcf/](https://adafruit.github.io/web-bdftopcf/) and click the "Browse" button.

![circuitpython_ksnip_20210105-081830.png](https://cdn-learn.adafruit.com/assets/assets/000/098/453/medium640/circuitpython_ksnip_20210105-081830.png?1609856326)

Select a **.bdf** file from your computer and click Open.

![circuitpython_ksnip_20210105-084041.png](https://cdn-learn.adafruit.com/assets/assets/000/098/457/medium640/circuitpython_ksnip_20210105-084041.png?1609857680)

After a moment, the font will be prepared in **.pcf** format and depending on your browser settings it may be automatically downloaded or you may have to confirm that you want to download the file.

![circuitpython_ksnip_20210105-084143.png](https://cdn-learn.adafruit.com/assets/assets/000/098/458/medium640/circuitpython_ksnip_20210105-084143.png?1609857718)

In this particular case, the **.pcf** version of the font is only half the size of the **.bdf** font, which leaves more space on the **CIRCUITPY** drive for other assets like sound files and bitmaps.

![circuitpython_ksnip_20210105-083937.png](https://cdn-learn.adafruit.com/assets/assets/000/098/459/medium640/circuitpython_ksnip_20210105-083937.png?1609857736)

# CircuitPython Display_Text Library

## Label Updating

Sometimes when you make labels, you will want to change the text that they are displaying at some point after they've been initialized. A common example of this would be showing the value being read from a sensor, then updating it as you make new readings from the sensor.

## Basic Example
This example initializes a label before the main loop begins. Then inside the main loop it updates the `text` property on the label with the value it gets from `time.monotonic()`. This example can be run on any CircuitPython device with a built-in display.&nbsp;

Updating the text property will change what appears in the label on the display.

In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, open the directory **updating\_text\_example/** &nbsp;and then click on the directory that matches the version of CircuitPython you're using and copy the contents of that directory to your **CIRCUITPY** drive.

Your **CIRCUITPY** drive should now look similar to the following image:

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/CircuitPython_Display_Text_updating_text_example.png )

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CircuitPython_Display_Text/updating_text_example/code.py

## What NOT To Do

Be careful not to create new labels infinitely in the main loop. It can lead to a Memory Error caused by making too many new labels.

Danger: 

```python
# SPDX-FileCopyrightText: 2020 Tim C, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
This examples shows the WRONG way change your displayed text in the main loop.
"""
import time
import board
import displayio
import terminalio
from adafruit_display_text import label

# built-in display
display = board.DISPLAY

# Make the display context
main_group = displayio.Group()
display.root_group = main_group


# Main loop
while True:
    
    # You should not create labels in an unrestriced manner like this.
    #
    # DONT DO THIS!!!
    #
    new_label = label.Label(
        font=terminalio.FONT, 
        text="Time Is:\n{}".format(time.monotonic()),
        scale=2,
        x=20, y=50
    )
    main_group.append(new_label)
    main_group.pop(0)
    
    time.sleep(1)
```


## Featured Products

### Adafruit MagTag - 2.9" Grayscale E-Ink WiFi Display

[Adafruit MagTag - 2.9" Grayscale E-Ink WiFi Display](https://www.adafruit.com/product/4800)
The Adafruit MagTag combines the ESP32-S2 wireless module and a 2.9" grayscale E-Ink display to make a low-power IoT display that can show data on its screen even when power is removed! The ESP32-S2 is great because it builds on the years of code and support for the ESP32 and also adds...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4800)
[Related Guides to the Product](https://learn.adafruit.com/products/4800/guides)
### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **PyPortal** , our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
### PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen

[PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen](https://www.adafruit.com/product/2298)
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a resistive&nbsp;touch overlay. The plate uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2298)
[Related Guides to the Product](https://learn.adafruit.com/products/2298/guides)
### Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers

[Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers](https://www.adafruit.com/product/3651)
Spice up your Feather project with a beautiful 3.5" touchscreen display shield with built in microSD card socket. This TFT display is 3.5" diagonal with a bright 6 white-LED backlight. You get a massive 480x320 pixels with individual 16-bit color pixel control. It has way more...

In Stock
[Buy Now](https://www.adafruit.com/product/3651)
[Related Guides to the Product](https://learn.adafruit.com/products/3651/guides)
### TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers

[TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers](https://www.adafruit.com/product/3315)
A Feather board without ambition is a Feather board without FeatherWings! Spice up your Feather project with a beautiful 2.4" touchscreen display shield with built in microSD card socket. This TFT display is 2.4" diagonal with a bright 4 white-LED backlight. You get&nbsp; 240x320...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3315)
[Related Guides to the Product](https://learn.adafruit.com/products/3315/guides)

## Related Guides

- [Adafruit 2.4" TFT FeatherWing](https://learn.adafruit.com/adafruit-2-4-tft-touch-screen-featherwing.md)
- [Adafruit 3.5" 480x320 TFT FeatherWing](https://learn.adafruit.com/adafruit-3-5-tft-featherwing.md)
- [Adafruit PyPortal - IoT for CircuitPython](https://learn.adafruit.com/adafruit-pyportal.md)
- [Adafruit MagTag](https://learn.adafruit.com/adafruit-magtag.md)
- [MagTag Daily Christmas Countdown](https://learn.adafruit.com/magtag-daily-christmas-countdown.md)
- [itsaSNAP by Adafruit](https://learn.adafruit.com/it-s-a-snap-by-adafruit.md)
- [PiGRRL 2](https://learn.adafruit.com/pigrrl-2.md)
- [PyPortal Air Quality Display](https://learn.adafruit.com/pyportal-air-quality-display.md)
- [PiTFT Python + Pillow Animated Gif Player](https://learn.adafruit.com/pitft-linux-python-animated-gif-player.md)
- [Cheerlights Holiday Wreath with Animations](https://learn.adafruit.com/cheerlights-led-animations.md)
- [CircuitPython Hardware: ILI9341 TFT & FeatherWing](https://learn.adafruit.com/micropython-hardware-ili9341-tft-and-featherwing.md)
- [MagTag James Webb Telescope Status](https://learn.adafruit.com/magtag-james-webb-telescope-status.md)
- [PyPortal YouTube Views and Subscribers Display](https://learn.adafruit.com/pyportal-youtube-views-and-subscribers-display.md)
- [PyPortal View Master](https://learn.adafruit.com/pyportal-view-master.md)
- [PyPortal NeoPixel Color Picker](https://learn.adafruit.com/pyportal-neopixel-color-picker.md)
- [League of Legends Level Trophy for PyPortal](https://learn.adafruit.com/league-of-legends-level-trophy-for-pyportal.md)
- [Creating Slideshows in CircuitPython](https://learn.adafruit.com/creating-slideshows-in-circuitpython.md)
- [MagTag Sports Schedule Viewer](https://learn.adafruit.com/magtag-sports-schedule-viewer.md)
- [A Floppy Thumb Drive with a Color File Icon Display](https://learn.adafruit.com/a-floppy-thumb-drive-with-a-color-file-icon-display.md)
