Badger 2040 - Invert error

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?

Try updating to the most recent Badger .uf2 - I think invert was quite a recent addition.

Your code works for me, though you might want to put your invert before your display.update otherwise it won’t show up!

Thanks - working now.

I was using the UF2 from the day Badger came out and did not know there had been an update.