peterhinch / micropython-nano-gui

A lightweight MicroPython GUI library for display drivers based on framebuf class
MIT License
492 stars 87 forks source link

Added text alignment to the Label widget #43

Closed jahr closed 1 year ago

jahr commented 1 year ago

I've added a new argument to the constructor of the Label widget. It allows aligning of the text inside the label to left (as it is now), right or center. If the text is wider than the label, the argument is ignored.

peterhinch commented 1 year ago

I have tested and documented this and made two changes:

  1. Add an align=None method to .value() to allow dynamic alignment.
  2. Simplified logic of .show().

Thank you for the contribution.