I got my Tufty yesterday and have been playing. I’m delighted with the supplied examples and the device as a whole.
I decided to explore the fonts in more detail and hit a couple of problems.
# Tufty_2040 Fonts demo
# Tony Goodhew 25th June, 2022
import utime
import random
from pimoroni import Button
from picographics import PicoGraphics, DISPLAY_TUFTY_2040
display = PicoGraphics(display=DISPLAY_TUFTY_2040)
WIDTH, HEIGHT = display.get_bounds()
#Set some colours
white = display.create_pen(200, 200, 255)
black = display.create_pen(0, 0, 0)
red = display.create_pen(255, 0, 0)
blue = display.create_pen(0 ,0, 255)
yellow = display.create_pen(255, 255 ,0)
green = display.create_pen(0, 255,0)
display.set_pen(black)
display.clear()
display.update()
display.set_pen(white)
display.text("Pimoroni", 20, 20, 240, 4)
display.text("Tufty_2040", 20, 45, 240, 4)
display.text("Font", 20, 70, 240, 4)
display.set_pen(yellow)
display.text("Demonstration", 20, 100, 240, 4)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("bitmap8")
display.text("Hello World", 0, 0, scale=2)
display.set_font("bitmap6")
display.text("Hello World", 0, 15, scale=2)
display.set_font("bitmap14_outline")
display.text("Pimoroni", 0, 25, scale=2)
display.set_font("sans")
display.text("Pimoroni", 0, 65, scale=1)
display.set_font("gothic")
display.text("Pimoroni", 0, 90, scale=1)
width = display.measure_text("Centred", scale=1)
x = int((320 - width)/2)
display.set_pen(blue)
display.text("Centred",x, 115, scale=1)
display.set_pen(green)
display.set_font("serif")
display.text("Pimoroni", 0, 140, scale=1)
display.set_pen(red)
display.set_font("serif_italic")
display.text("Pimoroni", 0, 170, scale=1)
display.set_pen(white)
display.set_font("cursive")
display.text("Pimoroni", 0, 200, scale=1.4)
display.set_font("serif")
display.set_pen(yellow)
display.text("Angle 300 deg", 190, 230, 200, scale=0.9, angle = 300)
display.set_font("sans")
display.set_pen(green)
display.text("Angle 30 deg", 130, 20, 30, scale=0.6, angle = 30)
display.update()
utime.sleep(3)
s=""
for i in range(32,128):
if (i % 28) == 0:
s = s+chr(32)
s = s + chr(i)
print(s)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("bitmap6")
#display.text(text, x, y, wordwrap, scale, angle, spacing)
display.set_pen(yellow)
display.text("bitmap6", 0, 10, 320,scale=3)
display.set_pen(white)
display.text(s, 0, 40, 320,scale=2)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("bitmap8")
#display.text(text, x, y, wordwrap, scale, angle, spacing)
display.set_pen(yellow)
display.text("bitmap8", 0, 10, 320,scale=3)
display.set_pen(white)
display.text(s, 0, 40, 320,scale=2)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("bitmap14_outline")
display.set_pen(yellow)
display.text("bitmap14_outline", 0, 10, 320,scale=2.2)
display.set_pen(white)
display.text(s, 0, 45, 300,scale=1.9)
display.update()
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("sans")
display.set_pen(yellow)
display.text("sans", 0, 10, 320,scale=1.7)
display.set_pen(white)
s = ""
for i in range(32,64):
s = s+chr(i)
display.text(s, 0, 45, 300,scale=0.5)
s = ""
for i in range(64,96):
s = s+chr(i)
display.text(s, 0, 65, 300,scale=0.5)
s = ""
for i in range(96,128):
s = s+chr(i)
display.text(s, 0, 85, 300,scale=0.5)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("serif")
display.set_pen(yellow)
display.text("serif", 0, 19, 320,scale=1.5)
display.set_pen(white)
s = ""
for i in range(32,64):
s = s+chr(i)
display.text(s, 0, 45, 300,scale=0.45)
s = ""
for i in range(64,96):
s = s+chr(i)
display.text(s, 0, 65, 300,scale=0.45)
s = ""
for i in range(96,128):
s = s+chr(i)
display.text(s, 0, 85, 300,scale=0.45)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("serif_italic")
display.set_pen(yellow)
display.text("serif_italic", 0, 19, 320,scale=1.5)
display.set_pen(white)
s = ""
for i in range(32,64):
s = s+chr(i)
display.text(s, 0, 65, 300,scale=0.45)
s = ""
for i in range(64,96):
s = s+chr(i)
display.text(s, 0, 85, 300,scale=0.45)
s = ""
for i in range(96,128):
s = s+chr(i)
display.text(s, 0, 105, 300,scale=0.45)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("gothic")
display.set_pen(yellow)
display.text("gothic", 0, 19, 320,scale=1.5)
display.set_pen(white)
s = ""
for i in range(32,64):
s = s+chr(i)
display.text(s, 0, 65, 300,scale=0.45)
s = ""
for i in range(64,96):
s = s+chr(i)
display.text(s, 0, 85, 300,scale=0.45)
s = ""
for i in range(96,128):
s = s+chr(i)
display.text(s, 0, 105, 300,scale=0.45)
display.update()
utime.sleep(2)
display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("cursive")
display.set_pen(yellow)
display.text("cursive", 0, 19, 320,scale=1.5)
display.set_pen(white)
s = ""
for i in range(32,64):
s = s+chr(i)
display.text(s, 0, 65, 300,scale=0.3)
s = ""
for i in range(64,96):
s = s+chr(i)
display.text(s, 0, 85, 300,scale=0.3)
s = ""
for i in range(96,128):
s = s+chr(i)
display.text(s, 0, 105, 300,scale=0.3)
display.update()
utime.sleep(2)
The first was that the word wrap did not work as expected so I had to modify my code as inserted spaces did not always get picked up to break a line.
The second was that the final section, CURSIVE, just crashed without an error. Lost connection with Thonny.
Not sure what is going on. I’d be glad of a bit of help.