Skip to content

drawIcon()

Draw an image straight onto the display.

display.drawIcon(filename, x, y)

This draws to the canvas and returns nothing, which is fast and best for images you will not change later. To keep a handle you can move or delete, create an Icon and add() it instead. Erase these drawings with clearDrawing().

Parameters

display.drawIcon(filename, x, y, width=None, height=None, rotation=0)
Parameter Type Default Description
filename str required The image file to load, ending in ".jpg" or ".png".
x int or float required The horizontal position of the top-left corner, in pixels.
y int or float required The vertical position of the top-left corner, in pixels.
width int or float None The width to scale the image to, in pixels. Defaults to the image's own width.
height int or float None The height to scale the image to, in pixels. Defaults to the image's own height.
rotation int or float 0 How far to turn the image, in degrees, counter-clockwise.