oled · LCD screen¶
Displays text or images on the LCD screen.
Class:
Oled
OledByPiBrain
- class openpibo.oled.Oled(w=128, h=64)[source]¶
Bases:
objectFunctions:
show()clear()set_font()draw_text()draw_image()draw_data()draw_rectangle()draw_ellipse()draw_line()invert()imshow()Uses the OLED or LCD.
- show()[source]¶
Shows the oled screen.
If you do not use this method, nothing is shown on the oled screen even if you draw.
- clear(image=True, fill=True, show=True)[source]¶
Clears the oled screen.
- Parameters:
image (bool) – Whether to reset the image
fill (bool) – Whether to reset the oled
show (bool) – Whether to show on the screen
- set_font(filename=None, size=None)[source]¶
Sets the font and text size for
draw_text.- Parameters:
filename (str) – Font file path (ttf, otf)
size (int) – Font size
- draw_text(points, text: str)[source]¶
Displays text (default font - supports Korean/English/Chinese/Japanese).
- Parameters:
points (tuple(int, int)) – Top-left coordinates of the text (x, y)
text (str) – Text content
- draw_image(filename)[source]¶
Draws an image file. Only png files of size 128x64 are allowed.
- Parameters:
filename (str) – Image file path
- draw_rectangle(points, fill=None)[source]¶
Draws a rectangle.
- Parameters:
points (tuple) – Top-left and bottom-right coordinates of the rectangle (x1, y1, x2, y2)
fill (bool) – Whether to fill
- draw_ellipse(points, fill=None)[source]¶
Draws an ellipse.
- Parameters:
points (tuple) – Top-left and bottom-right coordinates of the rectangle circumscribing the ellipse (x1, y1, x2, y2)
fill (bool) – Whether to fill
- class openpibo.oled.OledByPiBrain(w=240, h=320)[source]¶
Bases:
objectFunctions:
show()clear()set_font()draw_text()draw_image()draw_data()draw_rectangle()draw_ellipse()draw_line()imshow()Uses the OLED or LCD.
- show()[source]¶
Shows the oled screen.
If you do not use this method, nothing is shown on the oled screen even if you draw.
- clear(image=True, fill=True, show=True)[source]¶
Clears the oled screen.
- Parameters:
image (bool) – Whether to reset the image
fill (bool) – Whether to reset the oled
show (bool) – Whether to show on the screen
- set_font(filename=None, size=None)[source]¶
Sets the font and text size for
draw_text.- Parameters:
filename (str) – Font file path (ttf, otf)
size (int) – Font size
- draw_text(points, text: str, colors=(255, 255, 255))[source]¶
Displays text (default font - supports Korean/English/Chinese/Japanese).
- Parameters:
points (tuple(int, int)) – Top-left coordinates of the text (x, y)
text (str) – Text content
- draw_rectangle(points, fill=None)[source]¶
Draws a rectangle.
- Parameters:
points (tuple) – Top-left and bottom-right coordinates of the rectangle (x1, y1, x2, y2)
fill (bool) – Whether to fill
- draw_ellipse(points, fill=None)[source]¶
Draws an ellipse.
- Parameters:
points (tuple) – Top-left and bottom-right coordinates of the rectangle circumscribing the ellipse (x1, y1, x2, y2)
fill (bool) – Whether to fill