MantisIDE

Lesson 1: Hello, screen · Round 1.28" touch watch

Guide by MantisIDE Team · Fri Nov 27 2026 · 0 points · 0 comments

Lesson 1 - Hello, screen Goal: understand screens, objects and labels in LVGL 9. Everything you see is an lv.obj inside a *screen*. Widgets are created with lv.<widget>(parent) and positioned with align()/center(). The display is 240x240 and ROUND, so keep important things inside the middle circle.

You’ll learn: screens, objects, labels, align

Board: Waveshare ESP32-S3-Touch-LCD-1.28 (ESP32-S3R2). Part of the kit’s Learning roadmap, Level 1 · Foundations. Needs the board’s LVGL firmware: flash it from the notebook’s Flash button, then press Open in Full IDE.

# Lesson 1 - Hello, screen
# Goal: understand screens, objects and labels in LVGL 9.
#
# Everything you see is an lv.obj inside a *screen*. Widgets are created with
# lv.<widget>(parent) and positioned with align()/center(). The display is 240x240
# and ROUND, so keep important things inside the middle circle.
import lvgl as lv
import display

display.init()                     # start the display and touch (does nothing if already on)
scr = lv.screen_active()             # the screen LVGL is showing  # a fresh, dark green screen
scr.clean()                           # remove what the last program drew
scr.set_style_bg_color(lv.color_hex(0x0B1F14), 0)
scr.remove_flag(lv.obj.FLAG.SCROLLABLE)

title = lv.label(scr)                  # a label is a child of the screen
title.set_text("Hello, ESP32-S3!")
title.set_style_text_color(lv.color_hex(0xFFFFFF), 0)
title.center()                         # exactly in the middle

sub = lv.label(scr)
sub.set_text("LVGL 9 on a round display")
sub.set_style_text_color(lv.color_hex(0x8EA999), 0)
sub.align(lv.ALIGN.CENTER, 0, 28)      # 28 px below centre

# A circle that marks the visible area of the round screen
edge = lv.obj(scr)
edge.set_size(236, 236)
edge.center()
edge.set_style_radius(lv.RADIUS_CIRCLE, 0)
edge.set_style_bg_opa(lv.OPA.TRANSP, 0)
edge.set_style_border_color(lv.color_hex(0x46E07C), 0)
edge.set_style_border_width(2, 0)
edge.remove_flag(lv.obj.FLAG.CLICKABLE)

print("Try: change the text, colours and the 28 px offset, then press Run again.")
Loading post…

Dialog