pgzero | boilerplate games programming framework for Python | Game Engine library

 by   lordmauve Python Version: 1.2.1 License: LGPL-3.0

kandi X-RAY | pgzero Summary

kandi X-RAY | pgzero Summary

pgzero is a Python library typically used in Gaming, Game Engine, Framework, Pygame applications. pgzero has no bugs, it has no vulnerabilities, it has build file available, it has a Weak Copyleft License and it has high support. You can download it from GitHub.

A zero-boilerplate games programming framework for Python 3, based on Pygame.

            kandi-support Support

              pgzero has a highly active ecosystem.
              It has 459 star(s) with 161 fork(s). There are 26 watchers for this library.
              It had no major release in the last 6 months.
              There are 87 open issues and 141 have been closed. On average issues are closed in 664 days. There are 22 open pull requests and 0 closed requests.
              It has a negative sentiment in the developer community.
              The latest version of pgzero is 1.2.1

            kandi-Quality Quality

              pgzero has 0 bugs and 0 code smells.

            kandi-Security Security

              pgzero has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pgzero code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pgzero is licensed under the LGPL-3.0 License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              pgzero releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              pgzero saves you 3199 person hours of effort in developing the same functionality from scratch.
              It has 6975 lines of code, 765 functions and 75 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pgzero and discovered the below as its top functions. This is intended to give you an instant insight into pgzero implemented functionality, and help decide if they suit your requirements.
            • Update the game
            • Calculate the vx of the bat centerx
            • Update a ball
            • Generate a maze
            • Reset the ball
            • Generate the maze
            • Convert a cell to a rectangle
            • Generate all neighbours of a given position
            • Reset the landing object
            • Checks if there is any spots within the given step
            • Helper to set the opacity of the actor
            • Load a sound file
            • Generate a random ship target
            • Draw a rectangle
            • Tells every tick in seconds
            • Rotate piece
            • Substitute the full framework python
            • Handle a mouse down
            • Performs the control loop
            • Draw the ship
            • Draw the trail
            • Place an apple
            • Creates a star
            • Resolves the dive mode of the controller
            • Generate a HTML table
            • Forward a key down
            • Load a module and run it
            Get all kandi verified functions for this library.

            pgzero Key Features

            No Key Features are available at this moment for pgzero.

            pgzero Examples and Code Snippets

            No Code Snippets are available at this moment for pgzero.

            Community Discussions


            Not able to display text in python with pgzero
            Asked 2022-Jan-31 at 20:39

            I am making a simple game in pgzero, but the screen. function never seems to work correctly.

            when I try to display text at the start like so:



            Answered 2022-Jan-31 at 20:39

            I have no familiarity with pgzero, but I installed it and played around, and when I put line inside the draw() function it runs fine:



            Can't load image into pygame
            Asked 2022-Jan-20 at 02:55

            enter image description hereI am learning python from a book called "Computer Coding Python Games For Kids" Here's the book The game is basically where you try to click on the red snowflake before it gets to the bottom My problem is that even if I store the image with the code in the same file it can't seem to find the image. If I try to write (C:\Users\Nigel\Desktop\python-games\find the red snowflake\image\red-snow)I get a Unicode error. here is my code



            Answered 2022-Jan-19 at 01:22

            If you're getting a unicode error for that path, that means you're probably not typing it right -- those backwards slashes you see in paths are normally used for "escape characters", and they can interfere when you're just trying to type the path to a file. Try one of these solutions, if you haven't already typed your path like this:



            i am trying to make the actor "player" show on screen (along with the other actors) and add controls to it
            Asked 2021-Aug-27 at 16:25
            import pgzero, pygame
            #music, sprites and background
            x = 0
            y = 0
            WIDTH = 850
            HEIGHT = 425
            screen = pygame.display.set_mode((WIDTH, HEIGHT))
            title = Actor('title.png')      #calling sprites and saying their pos
            title.pos = 400, 212
            cont = Actor('cont.png')
            cont.pos = 470, 300
            player = Actor('ship.png')
            player.pos = 100, 56
            foe = Actor('foe.png')
            foe.pos = 200, 112
            def draw():
            screen.fill((0, 0, 0))
            vel = 5
            while True:
                player.pos = x, y
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit(); sys.exit()
                        main = False
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_LEFT or event.key == ord('a'):
                            x -= vel
                        if event.key == pygame.K_RIGHT or event.key == ord('d'):
                            x += vel
                        if event.key == pygame.K_UP or event.key == ord('w'):
                            y += vel
                        if event.key == pygame.K_DOWN or event.key == ord('s'):
                            y -= vel
                    if event.type == pygame.KEYUP:
                        if event.key == pygame.K_LEFT or event.key == ord('a'):
                            print('left stop')
                        if event.key == pygame.K_RIGHT or event.key == ord('d'):
                            print('right stop')
                        if event.key == pygame.K_UP or event.key == ord('w'):
                            print('up stop')
                        if event.key == pygame.K_DOWN or event.key == ord('s'):
                            print('down stop')
                        if event.key == ord('q'):
                            main = False


            Answered 2021-Aug-27 at 16:25

            The Indentation in your code is incorrect after screen.clear(). You have to delete the complete while True:-loop. This code will not work with Pygame Zero. It is a Pygame application and event loop. Pygame Zero is based on Pygame but it is not the same. You cannot use Pygame zero, but the event handling of Pygame. Note draw is continuously invoked in the background. draw is the "application loop".

            A working example may look as follows:



            Pygame Zero Player Animation Code Is Not Working
            Asked 2021-Mar-08 at 04:02

            I have been trying to code a small game with a character that moves around. For some reason, I can't use gifs. After that, I turned the gif into a bunch of pngs and with that, I tried to write some code to animate it:



            Answered 2021-Mar-08 at 04:02

            In this line

            clock.schedule_interval(animate(), 0.5)

            clock.schedule_interval takes in a callable(a function) and the interval. By adding parentheses after animate, you're actually calling the function and passing its output. Since animate doesn't return anything(None), you're doing the same as this:

            clock.schedule_interval(None, 0.5)

            where it should be

            clock.schedule_interval(animate, 0.5)



            ModuleNotFoundError: No module named 'pgzrun' when I have it installed?
            Asked 2020-Dec-17 at 15:47

            Why does IDLE say

            ModuleNotFoundError: No module named 'pygame'

            when I have it installed? I installed it with pip. I tried deleting the import but then IDLE gives me a name error saying pygame isn't defined.. I tried doing



            Answered 2020-Jun-23 at 00:37

            Got to python/scripts path and try to uninstall it with python -m pip uninstall pygame then install it with python -m pip install pygame --user

            When installing a python package without --user, pip defaults to installing it on the system directory such as /usr/local/lib/python3, and this requires root access. While when using --user, pip installs the package in your home directory which doesn't require any root access or special privileges. So that leaves us with two ways to install Pygame correctly, The first one is to use --user to install it without special privileges and the Second choice is to run the terminal as an administrator on Windows or as root on Linux to give it root access for it to download Pygame successfully.



            NameError: name 'Actor' is not defined in pgzrun/python
            Asked 2020-Dec-10 at 23:16

            here is my problem - I am trying to re-build KNIGHT’S QUEST game based on book "Beginner's Step-by-Step coding course" (Download the complete Coding Course Resource Pack). And I have got Error message: NameError: name 'Actor' is not defined. I also read related one-year old article about the same problem here: Name 'Actor' is not defined and added to my code this line: from pgzero.builtins import Actor, animate, keyboard, but then I got this error message: error: cannot convert without pygame.display initialized. The same error occurs even when I try to run original game provided by issuer (I downloaded it without modification). This is my code where error occurs:



            Answered 2020-Jun-09 at 08:57

            Problem partially solved - code somehow runs on Windows machine (Anaconda/Spyder) (it does not run on Ubuntu-Anaconda/Spyder machine), although it runs with issues - when I run it inside Spyder, it gives error message and does not compile, but when I test it and run from Terminal Python + name of the it executes well.



            Why is screen not defined in a program when looped?
            Asked 2020-Aug-13 at 17:29

            When I try to make a circle at the mouse coordinates, I use this code:



            Answered 2020-Aug-13 at 17:29

            I don't know where your screen is being defined, so I can't be sure what's causing the issue. Here is some working code based on your sample. It draws a circle at the mouse position.



            Pyinstaller Unable to access Data Folder
            Asked 2020-Jul-30 at 22:30

            Below is the game.spec file that I have created. When running the below command, the app gets created perfectly



            Answered 2020-Jul-30 at 22:30

            When pyInstaller (or cx_Freeze, py2exe, etc.) make an executable, all the program files, along with PyGame, Python and a bunch of other stuff is all compressed up.

            When it's run, the first thing to happen is that archive of stuff is unpacked. Unpacked somewhere. Then your executable is started, but not from the location of the unpack.

            To fix this, your script has to determine the location it is running from - that is the full path to the script. Then use this location to find all the program's extra files.



            local variable refernced before assigement error
            Asked 2020-Mar-21 at 05:52

            I am very new to codding and am trying to make a game I can call my own. I don't undertand what the error means but here is my code:



            Answered 2020-Mar-21 at 05:49

            try making ozol global by


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install pgzero

            You can download it from GitHub.
            You can use pgzero like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone lordmauve/pgzero

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Game Engine Libraries


            by godotengine


            by photonstorm


            by libgdx


            by aseprite


            by BabylonJS

            Try Top Libraries by lordmauve


            by lordmauvePython


            by lordmauvePython


            by lordmauvePython


            by lordmauvePython


            by lordmauvePython