PewPew Library Reference¶
Initialize the module.
This function switches the display on and performs some basic setup.
Set the brightness of the display, from 0 (minimum) to 15 (maximum). On devices that don’t support varying the brightness this does nothing.
Show the provided image on the display, starting at the top left corner. You will want to call this once for every frame.
Return a number telling which keys (or buttons) have been pressed since the last check. The number can then be filtered with the
&operator and the
K_Oconstants to see whether any of the keys was pressed.
delayseconds have passed since the last call to this function. You can call it every frame to ensure a constant frame rate.
Pix(width=8, height=8, buffer=None)¶
Pix represents a drawing surface,
widthpixels wide and
bufferis specified for storing the data, a suitable one will be automatically created.
Creates a new Pix and initialzes its contents by iterating over
linesand then over individual pixels in each line. All the lines have to be at least as long as the first one.
from_text(cls, text, color=None, background=0, colors=None)¶
Creates a new Pix and renders the specified text on it. It is exactly the size needed to fit the specified text. Newlines and other control characters are rendered as spaces.
coloris not specified, it will use yellow and red for the letters by default. Otherwise it will use the specified color, with
backgroundcolor as the background.
colorsmay be specified as a 4-tuple of colors, and then the
backgroundarguments are ignored, and the four specified colors are used for rendering the text.
pixel(self, x, y, color=None)¶
coloris specified, sets the pixel at location
yto that color. If not, returns the color of the pixel at that location.
If the location is out of bounds of the drawing surface, returns 0.
box(self, color, x=0, y=0, width=self.width, height=self.height)¶
Draws a filled box with the specified
colorwith its top left corner at the specified location and of the specified size. If no location and size are specified, fills the whole drawing surface.
blit(self, source, dx=0, dy=0, x=0, y=0, width=None, height=None, key=None)¶
sourcedrawing surface onto this surface at location specified with
heightare specified, only copies that fragment of the
sourceimage, otherwise copies it whole.
keycolor is specified, that color is considered transparent on the source image, and is not copied onto this drawing surface.