luma.core.legacy
¶
These methods were originally present in the old MAX7219 driver, and are preserved here only to aid migration away from that library. The functions are denoted ‘legacy’ to discourage use - you are encouraged to use the various drawing capabilities in the Pillow library instead.
-
luma.core.legacy.
show_message
(device, msg, y_offset=0, fill=None, font=None, scroll_delay=0.03)[source]¶ Scrolls a message right-to-left across the devices display.
- Parameters
device – The device to scroll across.
msg (str) – The text message to display (must be ASCII only).
y_offset (int) – The row to use to display the text.
fill – The fill color to use (standard Pillow color name or RGB tuple).
font – The font (from
luma.core.legacy.font
) to use.scroll_delay (float) – The number of seconds to delay between scrolling.
-
luma.core.legacy.
text
(draw, xy, txt, fill=None, font=None)[source]¶ Draw a legacy font starting at
x
,y
using the prescribed fill and font.- Parameters
draw (PIL.ImageDraw) – A valid canvas to draw the text onto.
txt (str) – The text string to display (must be ASCII only).
xy (tuple) – An
(x, y)
tuple denoting the top-left corner to draw the text.fill – The fill color to use (standard Pillow color name or RGB tuple).
font – The font (from
luma.core.legacy.font
) to use.
-
luma.core.legacy.
textsize
(txt, font=None)[source]¶ Calculates the bounding box of the text, as drawn in the specified font. This method is most useful for when the
proportional
wrapper is used.- Parameters
txt (str) – The text string to calculate the bounds for
font – The font (from
luma.core.legacy.font
) to use.
luma.core.legacy.font
¶
Fixed-width font definitions. The following fonts are available:
Font name |
Notes |
Source |
---|---|---|
|
See https://en.wikipedia.org/wiki/Code_page_437 for further details. |
unascribed |
|
Only contains characters 0x20-0x7F inclusive and Cyrillic chars 0x80-0xBF (except ‘Ёё’); all others will appear as blanks. |
https://www.avrfreaks.net/forum/code-57-512-and-712-fonts?name=PNphpBB2&file=viewtopic&t=69880 |
|
Only contains characters 0x41-0x5A & 0x30-0x39 inclusive; all others will appear as blanks. |
|
|
Based on the character set from the Sinclair ZX Spectrum. Only contains characters 0x20-0x7E inclusive; all others will appear as blanks. |
|
|
Only contains characters 0x20-0x7E inclusive; all others will appear as blanks. |
|
|
Cyrillic Ukrainian font |
unascribed |