Peter Hinch GUIs

August 23, 2026 · View on GitHub

Three of Peter Hinch's MicroPython GUI libraries run unchanged on PyDevices hardware, which makes them the clearest demonstration of the stack's portability. Each is showcased on its own gallery page: peterhinch.html.

GUIInput styleSetup module
Nano-GUIDisplay-only, no input — for memory-constrained boardscolor_setup.py
Micro-GUIButtons / encoder, callback-style widgets (asyncio underneath)hardware_setup.py
MicroPython-TouchTouch widgets and async UI (developed from Micro-GUI)touch_setup.py

How the integration works

This repository does not vendor any of the three. Importing the setup module for the GUI you want calls fetch_ph_gui, which mip-installs the upstream gui/ tree into lib/utils/gui/ and patches its pygraphics.FrameBuffer isinstance checks. Display wiring goes through displaybuf.py, which supplies the ssd framebuffer the GUIs expect.

Only one Hinch GUI may occupy utils/gui/ at a time. fetch_ph_gui empties the directory when you switch between them. lib/utils/gui/ is gitignored.

Do not install Peter Hinch's drivers/ tree. It targets bare-metal MCU displays; here the display comes from your PyDevices board_config and color_setup.ssd / displaybuf instead. The same goes for upstream's touch/ package — touch input comes from the board config and, for non-LVGL apps, the application-owned appdev app.

Shared requirements

ComponentLocationNotes
board_config.pypydevices/board_configs/Display plus neutral input capabilities
setup modulelib/utils/color_setup.py, hardware_setup.py, or touch_setup.py — see the table above
fetch_ph_gui.pylib/utils/mip install into utils/gui/ plus the FrameBuffer patches
displaybuf.pylib/utils/The ssd framebuffer
uctypes.pylib/utils/CircuitPython shim for the GUIs' writer.py
gui/lib/utils/gui/Upstream — installed by the fetch, not in git

Installing manually

Usually unnecessary — importing the setup module does it. To install ahead of time, or on a target without mip at import time:

import mip
mip.install("github:PyDevices/pydevices-examples/packages/<name>.json", target="./utils")

where <name> is micropython-nano-gui, micropython-micro-gui, or micropython-touch.

Examples

Each GUI has a smoke test under lib/examples/, and each has a browser gallery loader that fetches the GUI through its setup module:

GUIExampleGallery
Nano-GUInano_gui_simpletest.pyloader
Micro-GUImicro_gui_simpletest.pyloader
MicroPython-Touchtouch_gui_simpletest.pyloader
cd pydevices-examples/lib
micropython -i utils/path.py examples/nano_gui_simpletest.py

For the Micro-GUI and MicroPython-Touch full demos, import the setup module then import gui.demos.simple.

Per-GUI notes

Nano-GUI

nano_gui_simpletest.py is the upstream hardware verification routine. For development against an editable upstream checkout, clone the whole gui/ tree in place of the fetch:

curl -sL https://github.com/peterhinch/micropython-nano-gui/archive/refs/heads/master.tar.gz \
  | tar xz --strip-components=2 -C src/utils micropython-nano-gui-master/gui

Micro-GUI

hardware_setup.py builds Display from appdev.App devices. Desktop navigation defaults:

KeyAction
Tab / RightNext control
LeftPrevious control
Enter / SpaceSelect
Up / DownIncrease / decrease

MicroPython-Touch

Upstream renamed hardware_setup.pytouch_setup.py in December 2024, and this repository follows that name. touch_setup.py wires a mouse/touch Poller into Display(ssd, tpad):

import touch_setup  # fetch + Display
from gui.core.tgui import Screen, ssd