Get a single character as a object.
def setup():
font = py5.create_font('DejaVu Sans', 32)
chr_p = font.get_shape('p')
chr_y = font.get_shape('y')
chr_5 = font.get_shape('5')
chr_p.disable_style()
chr_y.disable_style()
chr_5.disable_style()
py5.fill(0)
py5.no_stroke()
x = 25
py5.shape(chr_p, x, 40)
x += chr_p.get_width()
py5.shape(chr_y, x, 60)
x += chr_y.get_width()
py5.shape(chr_5, x, 80)
Get a single character as a object. Use the detail
parameter to draw the shape with only straight line segments.
Calling on the returned object seems to be necessary for these to be drawable.
This method only works on fonts loaded with .
Underlying Processing method: PFont.getShape
get_shape(
ch: chr, # single character
/,
) -> Py5Shape
get_shape(
ch: chr, # single character
detail: float, # level of shape detail
/,
) -> Py5Shape
Updated on March 06, 2023 02:49:26am UTC