Badger documentation:
Invert (aka Dark Mode)
Badger2040 can invert all your display data for a quick and easy dark mode:
invert(
inverted # bool: True to invert, False to... not invert!
)
Running this:
# Invert Test
# Tony Goodhew 4 March 2022
import badger2040
import machine
import time
fonts = ["sans","gothic","cursive","serif","serif_italic"]
display = badger2040.Badger2040()
display.update_speed(badger2040.UPDATE_NORMAL) # Slow but clearest
# Clear screen to white
display.pen(15)
display.clear()
display.update()
# Set up text
display.font(fonts[3])
display.thickness(2)
display.pen(0)
space = (display.measure_text("Dither/Colour",1.0))
space = int((296-space)/2)
display.text("Badger 2040",space,50,1.0)
display.update()
display.invert(True) # <============= PROBLEM =============
time.sleep(3)
display.pen(15)
display.clear()
display.update()
# Set up text
display.font(fonts[3])
display.thickness(2)
display.pen(0)
space = (display.measure_text("Dither/Colour",1.0))
space = int((296-space)/2)
display.text("Badger 2040",space,50,1.0)
display.update()
Produces the following error:
Traceback (most recent call last):
File "<stdin>", line 23, in <module>
AttributeError:'badger2040' object has no attribute 'invert'
Am I doing something wrong?