Table, calendar, tabs · Round 1.28" touch watch
Widget gallery 7 - Table, calendar and tabview
You’ll learn: table, calendar, tabview
Board: Waveshare ESP32-S3-Touch-LCD-1.28 (ESP32-S3R2). Part of the kit’s Widget gallery. Needs the board’s LVGL firmware: flash it from the notebook’s Flash button, then press Open in Full IDE.
# Widget gallery 7 - Table, calendar and tabview
import lvgl as lv
import display
display.init() # start the display and touch (does nothing if already on)
BG = 0x05110A
PANEL = 0x0C1A12
TEXT = 0xE3EFE6
keep = [] # styles, buffers and callbacks LVGL uses must stay referenced
scr = lv.screen_active() # the screen LVGL is showing
scr.clean() # remove what the last program drew
scr.set_style_bg_color(lv.color_hex(BG), 0)
scr.remove_flag(lv.obj.FLAG.SCROLLABLE)
tabs = lv.tabview(scr)
tabs.set_size(200, 200)
tabs.center()
if hasattr(tabs, "set_tab_bar_position"):
tabs.set_tab_bar_position(lv.DIR.TOP)
if hasattr(tabs, "set_tab_bar_size"):
tabs.set_tab_bar_size(32)
tabs.set_style_bg_color(lv.color_hex(PANEL), 0)
# Tab 1: table
t1 = tabs.add_tab("Table")
tbl = lv.table(t1)
tbl.set_column_count(2)
tbl.set_column_width(0, 80)
tbl.set_column_width(1, 70)
rows = [("Day", "Steps"), ("Mon", "6 210"), ("Tue", "8 904"), ("Wed", "4 377"), ("Thu", "10 012")]
for r, (a, b) in enumerate(rows):
tbl.set_cell_value(r, 0, a)
tbl.set_cell_value(r, 1, b)
tbl.set_style_text_font(lv.font_montserrat_12, lv.PART.ITEMS)
# Tab 2: calendar
t2 = tabs.add_tab("Calendar")
cal = lv.calendar(t2)
cal.set_size(170, 150)
cal.center()
cal.set_today_date(2026, 11, 22)
cal.set_month_shown(2026, 11)
cal.set_style_text_font(lv.font_montserrat_12, 0)
highlights = []
for d in (3, 14, 22):
dt = lv.calendar_date_t()
dt.year, dt.month, dt.day = 2026, 11, d
highlights.append(dt)
cal.set_highlighted_dates(highlights, len(highlights))
keep.append(highlights)
# Tab 3: plain text
t3 = tabs.add_tab("Info")
info = lv.label(t3)
info.set_text("Tabs hold any widgets.\nSwipe or tap the\ntab bar to switch.")
info.set_style_text_color(lv.color_hex(TEXT), 0)
print("Tap the tab names: table, calendar, info.")
Comments