• sales

    +86-0755-88291180

Pico fonts for 3.5 inch LCD Touch Screen 65K Colors SPI 480×320

2024-08-30 00:57:48 Ask

Are there any micropython examples for Pico showing large fonts?

3.5 inch LCD Touch Screen
2answers
SpotPearGuestb6838
Answer time:
2024-08-31 11:20:02
#Write characters, size is the font size, the minimum is 1  
    #Write characters, size is the font size, the minimum is 1
    def write_text(self,text,x,y,size,color):
        ''' Method to write Text on OLED/LCD Displays
            with a variable font size

            Args:
                text: the string of chars to be displayed
                x: x co-ordinate of starting position
                y: y co-ordinate of starting position
                size: font size of text
                color: color of text to be displayed
        '''
        background = self.pixel(x,y)
        info = []
        # Creating reference charaters to read their values
        self.text(text,x,y,color)
        for i in range(x,x+(8*len(text))):
            for j in range(y,y+8):
                # Fetching amd saving details of pixels, such as
                # x co-ordinate, y co-ordinate, and color of the pixel
                px_color = self.pixel(i,j)
                info.append((i,j,px_color)) if px_color == color else None
        # Clearing the reference characters from the screen
        self.text(text,x,y,background)
        # Writing the custom-sized font characters on screen
        for px_info in info:
            self.fill_rect(size*px_info[0] - (size-1)*x , size*px_info[1] - (size-1)*y, size, size, px_info[2])

You can add this code to increase the font size, but this is the default pixel font and there is no other style.

Like1

report

SpotPearGuest682a3
Answer time:
2024-08-31 14:52:45

Thanks so much for your help!

Like0

report

Price: $19.89
Part Number: Pico-ResTouch-LCD-3.5
Brand: Spotpear