""" This will draw a black background, then draw the word 'Scale' at scale 1, 2 and 3. """ import board import displayio import terminalio from adafruit_display_text import label import adafruit_displayio_sh1107 displayio.release_displays() # My test display is a Pimoroni OLED using the SH1107 connected by I2C on a Raspberry Pi WIDTH = 128 HEIGHT = 128 display_bus = displayio.I2CDisplay(board.I2C(), device_address=0x3C) display = adafruit_displayio_sh1107.SH1107(display_bus, width=WIDTH, height=HEIGHT) # Make the display context splash = displayio.Group(max_size=10) display.show(splash) # Draw a black background bg_bitmap = displayio.Bitmap(WIDTH, HEIGHT , 1) bg_palette = displayio.Palette(1) bg_palette[0] = 0x000000 splash.append(displayio.TileGrid(bg_bitmap, pixel_shader=bg_palette)) test_label1 = label.Label(terminalio.FONT, text="Scale", scale=1, color=0xFFFFFF, x=8, y=8) print("Test1 : before append to splash") print(f" Scale {test_label1.scale}") print(f" AbsoluteTransformScale {test_label1._layers[0]._absolute_transform}") splash.append(test_label1) print("Test1 : after append to splash") print(f" Scale {test_label1.scale}") print(f" AbsoluteTransformScale {test_label1._layers[0]._absolute_transform}") print() test_label2 = label.Label(terminalio.FONT, text="Scale", scale=2, color=0xFFFFFF, x=8, y=38) print("Test2 : before append to splash") print(f" Scale {test_label2.scale}") print(f" AbsoluteTransformScale {test_label2._layers[0]._absolute_transform}") splash.append(test_label2) print("Test2 : after append to splash") print(f" Scale {test_label2.scale}") print(f" AbsoluteTransformScale {test_label2._layers[0]._absolute_transform}") print() test_label3 = label.Label(terminalio.FONT, text="Scale", scale=3, color=0xFFFFFF, x=8, y=88) print("Test3 : before append to splash") print(f" Scale {test_label3.scale}") print(f" AbsoluteTransformScale {test_label3._layers[0]._absolute_transform}") splash.append(test_label3) print("Test3 : after append to splash") print(f" Scale {test_label3.scale}") print(f" AbsoluteTransformScale {test_label3._layers[0]._absolute_transform}")