tft – Control of the TFT display

class tft.TFT(auto_update=True, transparent_color=(0, 0, 0), backlight_pwm=None)[source]

The TFT display driver.

When the “codex” module loads, it creates “codex.tft” (the singleton instance of this TFT class). It also creates an initial root Canvas in “codex.display” and a console Canvas in “codex.console”. You can get this “codex.display” and start drawing on the screen with it. You can get this “codex.console” and start printing text over the drawings.

Or you can create a new Canvas and use “tft.display=” and “tft.console=” to replace the existing Canvases.

The default “codex.tft” is set to “auto_update=True”. The display will automatically refresh with any changes you make to the display or console.

For advanced applications, you can set the “codex.tft” to “auto_update=False”. The screen will only update when you call “update” on the “codex.tft” object. This allows you to make lots of changes to the object tree and show the changes all at once.

Create the TFT controller. There should be exactly one of these – ever.

Don’t create one of these yourself. Instead, use “codex.tft”.


auto_update (bool, optional) – Initial state of the display auto-update. Default is True.

property auto_update

Get or set the auto-update status.

The default is True.

In “auto_update=True” mode, changes to the screen happen automatically as soon as they are made.

In “auto_update=False” mode, changes to the screen must be triggered manually with the “update()” method.

property brightness

Get or set the TFT backlight level.

The default is 80 (80%).

The brightness is a percent between 0 (off) and 100 (full on).

property console

Get or set the root console Canvas.

The console canvas is drawn above the display object.

property display

Get or set the root display Canvas.

The display canvas is drawn beneath the console object.


Manually redraw the display.

This is used in “auto_update=False” mode to update the display.

Download Source