MicroPython-ST7735
MicroPython-ST7735 copied to clipboard
placing a small image somewhere on the screen
hello im trying to make a little wether and notifications display but cant figure out how to place a small bmp image say for clouds or the sun i haven noticed there is an image() function but cant get it to work
Please refer to tftbmp.py. It is an example of showing a small bitmap file on the screen.
Hi! I'm trying to put another bmp file, it's 128x160 px like yours but it seems not working. Can you help me?
Please refer to tftbmp.py. It is an example of showing a small bitmap file on the screen.
cool, and it works for me, but I want to show 32x32px app icon on my display and want to make them in 3x3 grid. What do I need to modify in tftbmp.py?
@boochow
@tANDyeet to draw rectangular images, (1) use _setwindowloc((x0,y0), (x1,y1)) to define the area to be drawn, then (2) call _pushcolor(16-bit int) for the number of pixels in the area to draw each pixel.
Example (for RPi pico):
from machine import SPI,Pin
from ST7735 import TFT
spi = SPI(0, baudrate=20000000, polarity=0, phase=0, sck=Pin(2), mosi=Pin(3), miso=Pin(0))
tft=TFT(spi,4,5,1)
tft.initr()
tft.rgb(True)
for x in range(3):
for y in range(3):
tft._setwindowloc((x * 32, y * 32), (x * 32 + 31, y * 32 + 31))
for c in range(1024):
tft._pushcolor(TFT.color((c >> 5) << 3, (c & 0x1f) << 3, (-c & 0x1f) << 3))
Thanks a lot! Now I can resume my project :)