Package: pxng
PXNGPXNGis a python library that provides a simplified API for working with pixels, drawing shapes, writing text and interacting with input devices. It is inspired by theolcPixelGameEngineby OneLoneCoder.What it can do:Create a window for drawing. The window supports rendering at a lower virtual resolution.Render text. The built in font is C64 styled.Render filled shapes. Currently only rectangles. :)Render sprites. Sprites can be scaled and blend with the background. Created from NumPy arrays. It is also possible to useimageioto read files directly in to sprites. Any changes in the data buffer of the sprite can be updated in the live rendering.Animated sprites. Using a sprite sheetpxngsupports animation.Poll the keyboard for events.How to installInstallation ofpxngis done simply by:pip install pxng. The examples are not part of the distribution.Getting startedBefore venturing into the examples, let us try aHello, world!example first.importpxngfrompxng.colorsimport*This will import thepxnglibrary and get some named colors that we can use.if__name__=='__main__':window=pxng.Window(640,480,'PixelEngine',scale=2,vsync=True)window.set_update_handler(update)window.start_event_loop()This will create a 640x480 window with a scale of 2. This scaling factor results in avirtualresolution of 320x240. We setvsync=trueto limit the frame rate to 60 frames per second (Hz). Finally we set the update handler to point to a function we have not made yet, calledupdate.defupdate(window:pxng.Window):window.draw_text(100,100,"Hello, world!",tint=LIGHT_GREEN)Theupdatefunction has a single argument that is provided by the framework and it iswindow. This is the context that you will use to draw and handle interaction. In this case we use thedraw_textfunction to write our "Hello, world!" message at(x, y) = (100, 100)in a light green color.Running this should result in the following screenshot:ExamplesIn the examples folder there are three applications that show how the library is used to perform different tasks. These examples does not show the most efficient way of doing the task, however.Palette - By abusingfill_rectthe following screenshot was created. The live rendering animates the color of the lowerHSLview and all  of theRGBviews.Animated Sprites - Shows some of the possibilities of rendering sprite sheets. All of the visible sprites in the screenshot are animated by  sub indexing the sprite sheet in a 8x8 grid. Left click and drag to move one of the sprites (the largest running character) around.Text Rendering - This example shows animated rendering of text. The green field of hexadecimal numbers scrolls by as fast as it can. Pressspaceto stop the animation. Use theupanddownarrow keys,page upandpage downorhomeandendto navigate in the scrolling text. Mouse scrolling is also supported.CopyrightsC64 font - The font is included as part of the repository and the license
is available here:https://style64.org/c64-truetype/licenseolcPixelGameEngine -https://github.com/OneLoneCoder/olcPixelGameEngineFreetype - The code for generating bitmap fonts as numpy arrays and rendering text with OpenGL Display Lists is copyrighted by Nicolas P. Rougier.https://github.com/rougier/freetype-py/blob/master/examples/opengl.pyCreditsthekingphoenix and Bonsaiheldin for the character spritepara for particle effects