{
  "id": "task_libraries:game-development/python",
  "path": "/exapedia/python-game-development-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python game development libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python game development libraries open a window, read keyboard and mouse input, draw sprites or scenes, and play sound from Python code. A game framework runs a loop that handles input, updates the game state, and draws a new frame many times a second. These libraries let developers build prototypes, teaching projects, and small games without a full commercial engine."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python game development libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#pygame",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F130"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyglet",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F32"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pygame-ce",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F158"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#panda-d",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F57"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ursina",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#arcade",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F204"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F80"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyxel",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F218"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "pypi"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#pygame",
          "label": [
            {
              "t": "text",
              "text": "pygame"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F131"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Spatial entity hierarchy",
            "Native tilemap assets"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#pygame",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F130"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyglet",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F152"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pygame-ce",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F158"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#panda-d",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F186"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ursina",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#arcade",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F204"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyxel",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F218"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "pygame",
          "name": [
            {
              "t": "fact",
              "fact": "F130"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pygame/pygame"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pygame"
            },
            {
              "label": "Docs",
              "href": "https://www.pygame.org/docs/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://www.pygame.org/docs/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F130"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F142"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/patrickloeber/snake-ai-pytorch",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _update_ui(self):\n    self.display.fill(BLACK)\n\n    for pt in self.snake:\n        pygame.draw.rect(self.display, BLUE1, pygame.Rect(pt.x, pt.y, BLOCK_SIZE, BLOCK_SIZE))\n        pygame.draw.rect(self.display, BLUE2, pygame.Rect(pt.x+4, pt.y+4, 12, 12))\n\n    pygame.draw.rect(self.display, RED, pygame.Rect(self.food.x, self.food.y, BLOCK_SIZE, BLOCK_SIZE))\n\n    text = font.render(\"Score: \" + str(self.score), True, WHITE)\n    self.display.blit(text, [0, 0])\n    pygame.display.flip()",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/patrickloeber/snake-ai-pytorch/blob/7ea69e6b79c59db731d8befc9ec174b075efc808/game.py#L112-L123",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F141"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20pygame%20for%20game%20rendering%20and%20simulation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F130"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pygame\n\npygame.init()\nscreen = pygame.display.set_mode((640, 480))\nrunning = True\nwhile running:\n    for event in pygame.event.get():\n        if event.type == pygame.QUIT:\n            running = False\n    screen.fill(\"black\")\n    pygame.display.flip()\npygame.quit()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://www.pygame.org/docs/",
                  "label": [
                    {
                      "t": "text",
                      "text": "docs.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F135"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pyglet",
          "name": [
            {
              "t": "fact",
              "fact": "F144"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pyglet/pyglet"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pyglet"
            },
            {
              "label": "Docs",
              "href": "https://docs.pyglet.org/en/latest/programming_guide/quickstart.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F37"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F32"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.pyglet.org/en/latest/programming_guide/quickstart.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F144"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F45"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/moderngl/moderngl-window",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F156"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def __init__(self, **kwargs: Any):\n    super().__init__(**kwargs)\n\n    config = pyglet.gl.Config(\n        major_version=self.gl_version[0],\n        minor_version=self.gl_version[1],\n        forward_compatible=True,\n        red_size=8,\n        green_size=8,\n        blue_size=8,\n        alpha_size=8,\n        stencil_size=8,\n        depth_size=24,\n        double_buffer=True,\n        sample_buffers=1 if self.samples > 1 else 0,\n        samples=self.samples,\n    )\n\n    if self.fullscreen:\n        if hasattr(pyglet, 'canvas'):\n            display = pyglet.canvas.get_display()\n        else:\n            display = pyglet.display.get_display()\n        screen = display.get_default_screen()\n        self._width, self._height = screen.width, screen.height\n\n    self._window = PygletWrapper(\n        width=self._width,\n        height=self._height,\n        caption=self._title,\n        resizable=self._resizable,\n        visible=self._visible,\n        vsync=self._vsync,\n        fullscreen=self._fullscreen,\n        config=config,\n        file_drops=True and platform.system() != \"Darwin\",\n    )\n\n    self.cursor = self._cursor\n\n    self._window.event(self.on_key_press)\n    self._window.event(self.on_key_release)\n    self._window.event(self.on_mouse_motion)\n    self._window.event(self.on_mouse_drag)\n    self._window.event(self.on_resize)\n    self._window.event(self.on_close)\n    self._window.event(self.on_mouse_press)\n    self._window.event(self.on_mouse_release)\n    self._window.event(self.on_mouse_scroll)\n    self._window.event(self.on_text)\n    self._window.event(self.on_show)\n    self._window.event(self.on_hide)\n    self._window.event(self.on_file_drop)\n\n    self.init_mgl_context()\n    self._buffer_width, self._buffer_height = self._window.get_framebuffer_size()\n    self.set_default_viewport()",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/moderngl/moderngl-window/blob/aabbe827fc224bdc4d343de90d3f2b400b0e586d/moderngl_window/context/pyglet/window.py#L35-L91",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20pyglet%20for%20game%20rendering%20and%20simulation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F144"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pyglet\n\nwindow = pyglet.window.Window()\n\n@window.event\ndef on_draw():\n    window.clear()\n\npyglet.app.run()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.pyglet.org/en/latest/programming_guide/quickstart.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "hello_world.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F149"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pygame-ce",
          "name": [
            {
              "t": "fact",
              "fact": "F158"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pygame-community/pygame-ce"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pygame-ce"
            },
            {
              "label": "Docs",
              "href": "https://pyga.me/docs/ref/surface.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F165"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pyga.me/docs/ref/surface.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F158"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F172"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Farama-Foundation/Gymnasium",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F172"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def render(self):\n    if self.render_mode is None:\n        assert self.spec is not None\n        gym.logger.warn(\n            \"You are calling render method without specifying any render mode. \"\n            \"You can specify the render_mode at initialization, \"\n            f'e.g. gym.make(\"{self.spec.id}\", render_mode=\"rgb_array\")'\n        )\n        return\n\n    try:\n        import pygame\n        from pygame import gfxdraw\n    except ImportError as e:\n        raise DependencyNotInstalled(\n            'pygame is not installed, run `pip install \"gymnasium[classic-control]\"`'\n        ) from e\n\n    if self.screen is None:\n        pygame.display.init()\n        if self.render_mode == \"human\":\n            self.screen = pygame.display.set_mode(\n                (self.screen_width, self.screen_height)\n            )\n        else:  # mode == \"rgb_array\"\n            self.screen = pygame.Surface((self.screen_width, self.screen_height))\n    if self.clock is None:\n        self.clock = pygame.time.Clock()\n\n    world_width = self.x_threshold * 2\n    scale = self.screen_width / world_width\n    polewidth = 10.0\n    polelen = scale * (2 * self.length)\n    cartwidth = 50.0\n    cartheight = 30.0\n\n    if self.state is None:\n        return None\n\n    x = self.state\n\n    self.surf = pygame.Surface((self.screen_width, self.screen_height))\n    self.surf.fill((255, 255, 255))\n\n    l, r, t, b = -cartwidth / 2, cartwidth / 2, cartheight / 2, -cartheight / 2\n    axleoffset = cartheight / 4.0\n    cartx = x[0] * scale + self.screen_width / 2.0  # MIDDLE OF CART\n    carty = 100  # TOP OF CART\n    cart_coords = [(l, b), (l, t), (r, t), (r, b)]\n    cart_coords = [(c[0] + cartx, c[1] + carty) for c in cart_coords]\n    gfxdraw.aapolygon(self.surf, cart_coords, (0, 0, 0))\n    gfxdraw.filled_polygon(self.surf, cart_coords, (0, 0, 0))\n\n    l, r, t, b = (\n        -polewidth / 2,\n        polewidth / 2,\n        polelen - polewidth / 2,\n        -polewidth / 2,\n    )\n\n    pole_coords = []\n    for coord in [(l, b), (l, t), (r, t), (r, b)]:\n        coord = pygame.math.Vector2(coord).rotate_rad(-x[2])\n        coord = (coord[0] + cartx, coord[1] + carty + axleoffset)\n        pole_coords.append(coord)\n    gfxdraw.aapolygon(self.surf, pole_coords, (202, 152, 101))\n    gfxdraw.filled_polygon(self.surf, pole_coords, (202, 152, 101))\n\n    gfxdraw.aacircle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n    gfxdraw.filled_circle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n\n    gfxdraw.hline(self.surf, 0, self.screen_width, carty, (0, 0, 0))\n\n    self.surf = pygame.transform.flip(self.surf, False, True)\n    self.screen.blit(self.surf, (0, 0))\n    if self.render_mode == \"human\":\n        pygame.event.pump()\n        self.clock.tick(self.metadata[\"render_fps\"])\n        pygame.display.flip()\n\n    elif self.render_mode == \"rgb_array\":\n        return np.transpose(\n            np.array(pygame.surfarray.pixels3d(self.screen)), axes=(1, 0, 2)\n        )",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Farama-Foundation/Gymnasium/blob/68c3f95def1b9d91922db5363a28dc1d4a83a960/gymnasium/envs/classic_control/cartpole.py#L251-L346",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F171"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pygame-ce%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F158"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/MyreMylar/pygame_gui",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def apply_colour_to_surface(\n    colour: pygame.Color,\n    shape_surface: pygame.surface.Surface,\n    rect: Union[pygame.Rect, None] = None,\n):\n    \"\"\"\n    Apply a colour to a shape surface by multiplication blend. This works best when the shape\n    surface is predominantly white.\n\n    :param colour: The colour to apply.\n    :param shape_surface: The shape surface to apply the colour to.\n    :param rect: A rectangle to apply the colour inside.\n\n    \"\"\"\n    if rect is not None:\n        colour_surface = pygame.surface.Surface(\n            rect.size, flags=pygame.SRCALPHA, depth=32\n        )\n        colour_surface.fill(colour)\n        shape_surface.blit(colour_surface, rect, special_flags=pygame.BLEND_RGBA_MULT)\n    else:\n        colour_surface = pygame.surface.Surface(\n            shape_surface.get_size(), flags=pygame.SRCALPHA, depth=32\n        )\n        colour_surface.fill(colour)\n        shape_surface.blit(colour_surface, (0, 0), special_flags=pygame.BLEND_RGBA_MULT)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/MyreMylar/pygame_gui/blob/9c12c28111a979dea6b192d2bc1baf7c7c37e7e5/pygame_gui/core/utility.py#L341-L366",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F175"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pygame-ce%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F158"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pygame\n\nsurface = pygame.Surface((640, 480))\nsurface.fill(\"black\")\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pyga.me/docs/ref/surface.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "surface.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "panda-d",
          "name": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/panda3d/panda3d"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/panda3d"
            },
            {
              "label": "Docs",
              "href": "https://docs.panda3d.org/1.10/python/introduction/tutorial/starting-panda3d"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F62"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F57"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.panda3d.org/1.10/python/introduction/tutorial/starting-panda3d",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/pokepetter/ursina",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F190"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def generate(self): # Must be called after a mesh's values has been updated in order to update visually\n    self._generated_vertices = None\n\n    if hasattr(self, 'geomNode'):\n        self.geomNode.removeAllGeoms()\n    else:\n        self.geomNode = p3d.GeomNode('mesh_geom')\n        self.attachNewNode(self.geomNode)\n\n    if len(self.vertices) == 0 and self.vertex_buffer is None:\n        return\n\n    static_mode = p3d.Geom.UHStatic if self.static else p3d.Geom.UHDynamic\n    vertex_format = p3d.GeomVertexFormat()\n\n    color_attribute_index = -1\n    uv_attribute_index = -1\n    normal_attribute_index = -1\n\n    if self.vertex_buffer is not None:\n        vertex_array_format = p3d.GeomVertexArrayFormat()\n        attributes = self.vertex_buffer_format.split(\",\")\n        for attribute in attributes:\n            attribute_type = attribute[0]\n            attribute_type_name = attribute[0]\n            if attribute_type == \"p\":\n                attribute_type = p3d.Geom.C_point\n                attribute_type_name = \"vertex\"\n            elif attribute_type == \"c\":\n                attribute_type = p3d.Geom.C_color\n                attribute_type_name = \"color\"\n            elif attribute_type == \"t\":\n                attribute_type = p3d.Geom.C_texcoord\n                attribute_type_name = \"texcoord\"\n            elif attribute_type == \"n\":\n                attribute_type = p3d.Geom.C_normal\n                attribute_type_name = \"normal\"\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute type: {}.\".format(attribute_type))\n            attribute_count = int(attribute[1:-1])\n            attribute_dtype = attribute[-1]\n            if attribute_dtype == \"f\":\n                attribute_dtype = p3d.Geom.NT_float32\n            elif attribute_dtype == \"I\":\n                attribute_dtype = p3d.Geom.NT_uint32\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute data type: {}.\".format(attribute_dtype))\n            vertex_array_format.addColumn(attribute_type_name, attribute_count, attribute_dtype, attribute_type)\n        vertex_format.addArray(vertex_array_format)\n\n    else:\n        vertex_format = p3d.GeomVertexFormat()\n        vertex_format.add_array(p3d.GeomVertexFormat.getV3().arrays[0])\n        attribute_count = 1\n        if self.colors is not None and len(self.colors) > 0:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('color', 4, p3d.Geom.NT_float32, p3d.Geom.C_color))\n            color_attribute_index = attribute_count\n            attribute_count += 1\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('texcoord', 2, p3d.Geom.NT_float32, p3d.Geom.C_texcoord))\n            uv_attribute_index = attribute_count\n            attribute_count += 1\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('normal', 3, p3d.Geom.NT_float32, p3d.Geom.C_normal))\n            normal_attribute_index = attribute_count\n            attribute_count += 1\n\n    vertex_format = p3d.GeomVertexFormat.register_format(vertex_format)\n    vdata = p3d.GeomVertexData('vertex_data', vertex_format, static_mode)\n\n    if self.vertex_buffer is not None:\n        m = memoryview(self.vertex_buffer).cast('B')\n        vdata.unclean_set_num_rows(self.vertex_buffer_length)\n        array_handle = vdata.modify_array(0)\n        vmem = memoryview(array_handle).cast('B')\n        vmem[:] = m\n\n    else:\n        if isinstance(self.vertices[0], numbers.Real):\n            vdata.unclean_set_num_rows(len(self.vertices) // 3)\n        else:\n            vdata.unclean_set_num_rows(len(self.vertices))\n\n        self._set_array_data(vdata.modify_array(0), self._ravel(self.vertices), 'f')\n\n        if self.colors is not None and len(self.colors) > 0:\n            self._set_array_data(vdata.modify_array(color_attribute_index), self._ravel(self.colors), 'f')\n\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(uv_attribute_index), self._ravel(self.uvs), 'f')\n\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(normal_attribute_index), self._ravel(self.normals), 'f')\n\n    geom = p3d.Geom(vdata)\n    self.geom = geom\n\n    if len(self.triangles) == 0:    # no triangles provided, so just add them in order\n        prim = Mesh._modes[self.mode](static_mode)\n        prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n        parray = prim.modify_vertices()\n        n = len(self.vertices)\n        if isinstance(self.vertices[0], numbers.Real):\n            n = n // 3\n        triangles = [i for i in range(n)]\n        parray.unclean_set_num_rows(n)\n        self._set_array_data(parray, triangles, 'I')\n\n        prim.close_primitive()\n        geom.addPrimitive(prim)\n\n    else:\n        if not isinstance(self.triangles[0], numbers.Real): # triangles provided as [(0,1,2), (3,4,5,6), ...] etc., so unpack them\n            line_segments = []\n            indices = self.indices\n            for tup in self.triangles:\n                if len(tup) == 2:\n                    line_segments.append(tup)\n\n\n            for line_segment in line_segments:\n                prim = Mesh._modes['line'](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(line_segment))\n                self._set_array_data(parray, line_segment, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n            if len(indices) > 0:\n                prim = Mesh._modes[self.mode](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(indices))\n                self._set_array_data(parray, indices, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n        else:   # got triangles as [0,1,2,3,4,5], ie. flat\n            prim = Mesh._modes[self.mode](static_mode)\n            prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n            parray = prim.modify_vertices()\n\n            parray.unclean_set_num_rows(len(self.triangles))\n            self._set_array_data(parray, self._ravel(self.triangles), 'I')\n\n            prim.close_primitive()\n            geom.addPrimitive(prim)\n\n    self.geomNode.addGeom(geom)\n\n    if self.mode == 'point':\n        self.setTexGen(p3d.TextureStage.getDefault(), p3d.TexGenAttrib.MPointSprite)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/pokepetter/ursina/blob/41d036e20cfc3a873996ed98328d7073316714c2/ursina/mesh.py#L101-L255",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F189"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20panda3d%20for%20game%20rendering%20and%20simulation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from direct.showbase.ShowBase import ShowBase\n\napp = ShowBase()\napp.run()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.panda3d.org/1.10/python/introduction/tutorial/starting-panda3d",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F183"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "ursina",
          "name": [
            {
              "t": "fact",
              "fact": "F192"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pokepetter/ursina"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/ursina"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/pokepetter/ursina/readme"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F199"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/pokepetter/ursina/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from ursina import Ursina, Entity\n\napp = Ursina()\ncube = Entity(model=\"cube\")\napp.run()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/pokepetter/ursina/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=ursina%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F197"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "arcade",
          "name": [
            {
              "t": "fact",
              "fact": "F204"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pythonarcade/arcade"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/arcade"
            },
            {
              "label": "Docs",
              "href": "https://api.arcade.academy/en/stable/api_docs/api/window.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F85"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F80"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.arcade.academy/en/stable/api_docs/api/window.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F204"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F86"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F87"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F88"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F89"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F91"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F92"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F93"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/realpython/materials",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F216"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def on_update(self, delta_time: float):\n    \"\"\"Update all the game objects\n\n    Arguments:\n        delta_time {float} -- How many seconds since the last frame?\n    \"\"\"\n\n    # Check if you've picked up a coin\n    coins_hit = arcade.check_for_collision_with_list(\n        sprite=self.player, sprite_list=self.coins\n    )\n\n    for coin in coins_hit:\n        # Add the coin score to your score\n        self.score += COIN_VALUE\n\n        # Play the coin sound\n        arcade.play_sound(self.coin_pickup_sound)\n\n        # Remove the coin\n        coin.remove_from_sprite_lists()\n\n    # Are there more coins than allowed on the screen?\n    if len(self.coins) > COIN_COUNT:\n        # Stop adding coins\n        arcade.unschedule(function_pointer=self.add_coin)\n\n        # Show the mouse cursor\n        self.set_mouse_visible(True)\n\n        # Print the final score and exit the game\n        print(f\"Game over! Final score: {self.score}\")\n        exit()",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/realpython/materials/blob/639729466ecb2b88c2b4bf3fa37cc9454c72f941/top-python-game-engines/arcade/arcade_game.py#L137-L169",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F215"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20arcade%20for%20game%20rendering%20and%20simulation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F204"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import arcade\n\nwindow = arcade.Window(640, 480, \"Example\")\n\n@window.event\ndef on_draw():\n    window.clear()\n\narcade.run()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.arcade.academy/en/stable/api_docs/api/window.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "sprite_minimal.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F209"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pyxel",
          "name": [
            {
              "t": "fact",
              "fact": "F218"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/kitao/pyxel"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pyxel"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/kitao/pyxel/readme"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F225"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/kitao/pyxel/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F218"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pyxel\n\ndef update():\n    if pyxel.btnp(pyxel.KEY_Q):\n        pyxel.quit()\n\ndef draw():\n    pyxel.cls(0)\n    pyxel.text(5, 5, \"Hello\", 7)\n\npyxel.init(160, 120)\npyxel.run(update, draw)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/kitao/pyxel/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pyxel%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F218"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F223"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python game development library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#pygame",
          "label": [
            {
              "t": "text",
              "text": "pygame"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits two-dimensional games with a hand-written event and draw loop. "
        },
        {
          "t": "link",
          "href": "#arcade",
          "label": [
            {
              "t": "text",
              "text": "Arcade"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits two-dimensional games built around sprite lists, views, and callbacks. "
        },
        {
          "t": "link",
          "href": "#panda-d",
          "label": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ]
        },
        {
          "t": "text",
          "text": " and "
        },
        {
          "t": "link",
          "href": "#ursina",
          "label": [
            {
              "t": "text",
              "text": "Ursina"
            }
          ]
        },
        {
          "t": "text",
          "text": " suit three-dimensional games with a scene graph."
        }
      ]
    },
    {
      "q": "What is the best Python game engine?",
      "a": [
        {
          "t": "link",
          "href": "#panda-d",
          "label": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a full game engine with a live scene graph, model loading, collisions, and audio. "
        },
        {
          "t": "link",
          "href": "#ursina",
          "label": [
            {
              "t": "text",
              "text": "Ursina"
            }
          ]
        },
        {
          "t": "text",
          "text": " builds an entity and prefab framework on top of it for faster setup. "
        },
        {
          "t": "link",
          "href": "#pyxel",
          "label": [
            {
              "t": "text",
              "text": "Pyxel"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a retro engine with its own pixel graphics, sound, and asset editor."
        }
      ]
    },
    {
      "q": "Pygame vs pygame-ce: which should I use?",
      "a": [
        {
          "t": "link",
          "href": "#pygame-ce",
          "label": [
            {
              "t": "text",
              "text": "pygame-ce"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a separately published community fork that exposes the same pygame import and game APIs. A project installs one of the two distributions, and its dependency manifest names which one."
        }
      ]
    },
    {
      "q": "What is pyglet?",
      "a": [
        {
          "t": "link",
          "href": "#pyglet",
          "label": [
            {
              "t": "text",
              "text": "pyglet"
            }
          ]
        },
        {
          "t": "text",
          "text": " provides native windows, input, OpenGL graphics, and media playback for Python applications. It also loads sprites and models."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, pygame",
      "display": "pygame",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, pygame",
      "display": "2.7M",
      "asOf": "2026-11-17"
    },
    "F3": {
      "label": "License, pygame",
      "display": "LGPL",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, pygame",
      "display": "2.6.1, Sep 2024",
      "asOf": "2024-09-29"
    },
    "F5": {
      "label": "Package release date, pygame",
      "display": "Sep 2024",
      "asOf": "2024-09-29"
    },
    "F6": {
      "label": "Repository stars, pygame",
      "display": "9.0K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Sprite rendering, pygame",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Collision checks, pygame",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Audio playback, pygame",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Output formats, pygame",
      "display": "PNG",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, pygame",
      "display": "pip install pygame",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, pygame",
      "display": "Provides game-loop, drawing, input, audio, and sprite tools for Python.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, pygame",
      "display": "Gives direct game-loop control",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, pygame",
      "display": "Choose when to process input, update state, and draw each frame.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, pygame",
      "display": "Checks pixel-mask sprite collisions",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, pygame",
      "display": "Use collide_mask to test overlap between sprite collision masks.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, pygame",
      "display": "Events need servicing every frame",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, pygame",
      "display": "Process the event queue regularly to keep the window responsive.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations lead, pygame",
      "display": "Rotated sprites need fresh masks",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations, pygame",
      "display": "Recreate the collision mask when the sprite image changes.",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Quickstart, pygame",
      "display": "# Example file showing a basic pygame \"game loop\"\nimport pygame\n\n# pygame setup\npygame.init()\nscreen = pygame.display.set_mode((1280, 720))\nclock = pygame.time.Clock()\nrunning = True\n\nwhile running:\n    # poll for events\n    # pygame.QUIT event means the user clicked X to close your window\n    for event in pygame.event.get():\n        if event.type == pygame.QUIT:\n            running = False\n\n    # fill the screen with a color to wipe away anything from last frame\n    screen.fill(\"purple\")\n\n    # RENDER YOUR GAME HERE\n\n    # flip() the display to put your work on screen\n    pygame.display.flip()\n\n    clock.tick(60)  # limits FPS to 60\n\npygame.quit()\n\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function, pygame",
      "display": "def render(self):\n    if self.render_mode is None:\n        assert self.spec is not None\n        gym.logger.warn(\n            \"You are calling render method without specifying any render mode. \"\n            \"You can specify the render_mode at initialization, \"\n            f'e.g. gym.make(\"{self.spec.id}\", render_mode=\"rgb_array\")'\n        )\n        return\n\n    try:\n        import pygame\n        from pygame import gfxdraw\n    except ImportError as e:\n        raise DependencyNotInstalled(\n            'pygame is not installed, run `pip install \"gymnasium[classic-control]\"`'\n        ) from e\n\n    if self.screen is None:\n        pygame.display.init()\n        if self.render_mode == \"human\":\n            self.screen = pygame.display.set_mode(\n                (self.screen_width, self.screen_height)\n            )\n        else:  # mode == \"rgb_array\"\n            self.screen = pygame.Surface((self.screen_width, self.screen_height))\n    if self.clock is None:\n        self.clock = pygame.time.Clock()\n\n    world_width = self.x_threshold * 2\n    scale = self.screen_width / world_width\n    polewidth = 10.0\n    polelen = scale * (2 * self.length)\n    cartwidth = 50.0\n    cartheight = 30.0\n\n    if self.state is None:\n        return None\n\n    x = self.state\n\n    self.surf = pygame.Surface((self.screen_width, self.screen_height))\n    self.surf.fill((255, 255, 255))\n\n    l, r, t, b = -cartwidth / 2, cartwidth / 2, cartheight / 2, -cartheight / 2\n    axleoffset = cartheight / 4.0\n    cartx = x[0] * scale + self.screen_width / 2.0  # MIDDLE OF CART\n    carty = 100  # TOP OF CART\n    cart_coords = [(l, b), (l, t), (r, t), (r, b)]\n    cart_coords = [(c[0] + cartx, c[1] + carty) for c in cart_coords]\n    gfxdraw.aapolygon(self.surf, cart_coords, (0, 0, 0))\n    gfxdraw.filled_polygon(self.surf, cart_coords, (0, 0, 0))\n\n    l, r, t, b = (\n        -polewidth / 2,\n        polewidth / 2,\n        polelen - polewidth / 2,\n        -polewidth / 2,\n    )\n\n    pole_coords = []\n    for coord in [(l, b), (l, t), (r, t), (r, b)]:\n        coord = pygame.math.Vector2(coord).rotate_rad(-x[2])\n        coord = (coord[0] + cartx, coord[1] + carty + axleoffset)\n        pole_coords.append(coord)\n    gfxdraw.aapolygon(self.surf, pole_coords, (202, 152, 101))\n    gfxdraw.filled_polygon(self.surf, pole_coords, (202, 152, 101))\n\n    gfxdraw.aacircle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n    gfxdraw.filled_circle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n\n    gfxdraw.hline(self.surf, 0, self.screen_width, carty, (0, 0, 0))\n\n    self.surf = pygame.transform.flip(self.surf, False, True)\n    self.screen.blit(self.surf, (0, 0))\n    if self.render_mode == \"human\":\n        pygame.event.pump()\n        self.clock.tick(self.metadata[\"render_fps\"])\n        pygame.display.flip()\n\n    elif self.render_mode == \"rgb_array\":\n        return np.transpose(\n            np.array(pygame.surfarray.pixels3d(self.screen)), axes=(1, 0, 2)\n        )\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function reference, pygame",
      "display": "cartpole.py · render()",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project repository, pygame",
      "display": "Farama-Foundation/Gymnasium",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project stars, Farama-Foundation/Gymnasium",
      "display": "12.8K",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project push date, Farama-Foundation/Gymnasium",
      "display": "Nov 2026",
      "asOf": "2026-11-12"
    },
    "F27": {
      "label": "Library name, pyglet",
      "display": "pyglet",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Monthly downloads, pyglet",
      "display": "2.3M",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "License, pyglet",
      "display": "BSD",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Package release, pyglet",
      "display": "2.1.19, Oct 2026",
      "asOf": "2026-10-11"
    },
    "F31": {
      "label": "Package release date, pyglet",
      "display": "Oct 2026",
      "asOf": "2026-10-11"
    },
    "F32": {
      "label": "Repository stars, pyglet",
      "display": "2.2K",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Sprite rendering, pyglet",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Audio playback, pyglet",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Output formats, pyglet",
      "display": "PNG",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Install, pyglet",
      "display": "pip install pyglet",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "What it does, pyglet",
      "display": "Provides native windows, input, OpenGL graphics, and media playback for Python applications.",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths lead, pyglet",
      "display": "Exposes native OpenGL rendering",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths, pyglet",
      "display": "Use pyglet.gl directly or build on higher-level graphics abstractions.",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths lead, pyglet",
      "display": "Manages multiple native windows",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths, pyglet",
      "display": "Create separate windows across a multi-monitor desktop.",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations lead, pyglet",
      "display": "Legacy batching needs migration",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations, pyglet",
      "display": "Replace Batch.add with ShaderProgram vertex-list APIs in newer pyglet.",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations lead, pyglet",
      "display": "Video playback needs FFmpeg",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "limitations, pyglet",
      "display": "Install FFmpeg before playing video.",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Quickstart, pyglet",
      "display": "import pyglet\n\nwindow = pyglet.window.Window()\nlabel = pyglet.text.Label('Hello, world',\n                          font_name='Times New Roman',\n                          font_size=36,\n                          x=window.width//2, y=window.height//2,\n                          anchor_x='center', anchor_y='center')\n\n\n@window.event\ndef on_draw():\n    window.clear()\n    label.draw()\n\n\npyglet.app.run()\n",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project function, pyglet",
      "display": "def __init__(self):\n\n    # A Batch is a collection of vertex lists for batched rendering.\n    self.batch = pyglet.graphics.Batch()\n\n    # A TextureGroup manages an OpenGL texture.\n    self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())\n\n    # A mapping from position to the texture of the block at that position.\n    # This defines all the blocks that are currently in the world.\n    self.world = {}\n\n    # Same mapping as `world` but only contains blocks that are shown.\n    self.shown = {}\n\n    # Mapping from position to a pyglet `VertextList` for all shown blocks.\n    self._shown = {}\n\n    # Mapping from sector to a list of positions inside that sector.\n    self.sectors = {}\n\n    # Simple function queue implementation. The queue is populated with\n    # _show_block() and _hide_block() calls\n    self.queue = deque()\n\n    self._initialize()\n",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project function reference, pyglet",
      "display": "main.py · __init__()",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project repository, pyglet",
      "display": "fogleman/Minecraft",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project stars, fogleman/Minecraft",
      "display": "5.5K",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Project push date, fogleman/Minecraft",
      "display": "Jun 2023",
      "asOf": "2023-06-10"
    },
    "F52": {
      "label": "Library name, panda3d",
      "display": "Panda3D",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Monthly downloads, panda3d",
      "display": "211.3K",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "License, panda3d",
      "display": "Modified BSD License",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "Package release, panda3d",
      "display": "1.10.16, Dec 2025",
      "asOf": "2025-12-25"
    },
    "F56": {
      "label": "Package release date, panda3d",
      "display": "Dec 2025",
      "asOf": "2025-12-25"
    },
    "F57": {
      "label": "Repository stars, panda3d",
      "display": "5.3K",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Sprite rendering, panda3d",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Collision checks, panda3d",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Audio playback, panda3d",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Install, panda3d",
      "display": "pip install panda3d",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "What it does, panda3d",
      "display": "Provides a three-dimensional scene engine with Python bindings, collisions, and audio systems.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, panda3d",
      "display": "Includes a complete scene engine",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, panda3d",
      "display": "Use Python to control a scene-oriented game and rendering engine.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths lead, panda3d",
      "display": "Integrates Bullet physics",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths, panda3d",
      "display": "Use Bullet bodies for rigid-body dynamics and collision detection.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "limitations lead, panda3d",
      "display": "Collision systems stay separate",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations, panda3d",
      "display": "Bullet bodies do not collide with ODE bodies or native CollisionNodes.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "Quickstart, panda3d",
      "display": "from direct.showbase.ShowBase import ShowBase\n\nclass MyApp(ShowBase):\n\n    def __init__(self):\n        ShowBase.__init__(self)\n\napp = MyApp()\napp.run()\n\n",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Project function, panda3d",
      "display": "def generate(self): # Must be called after a mesh's values has been updated in order to update visually\n    self._generated_vertices = None\n\n    if hasattr(self, 'geomNode'):\n        self.geomNode.removeAllGeoms()\n    else:\n        self.geomNode = p3d.GeomNode('mesh_geom')\n        self.attachNewNode(self.geomNode)\n\n    if len(self.vertices) == 0 and self.vertex_buffer is None:\n        return\n\n    static_mode = p3d.Geom.UHStatic if self.static else p3d.Geom.UHDynamic\n    vertex_format = p3d.GeomVertexFormat()\n\n    color_attribute_index = -1\n    uv_attribute_index = -1\n    normal_attribute_index = -1\n\n    if self.vertex_buffer is not None:\n        vertex_array_format = p3d.GeomVertexArrayFormat()\n        attributes = self.vertex_buffer_format.split(\",\")\n        for attribute in attributes:\n            attribute_type = attribute[0]\n            attribute_type_name = attribute[0]\n            if attribute_type == \"p\":\n                attribute_type = p3d.Geom.C_point\n                attribute_type_name = \"vertex\"\n            elif attribute_type == \"c\":\n                attribute_type = p3d.Geom.C_color\n                attribute_type_name = \"color\"\n            elif attribute_type == \"t\":\n                attribute_type = p3d.Geom.C_texcoord\n                attribute_type_name = \"texcoord\"\n            elif attribute_type == \"n\":\n                attribute_type = p3d.Geom.C_normal\n                attribute_type_name = \"normal\"\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute type: {}.\".format(attribute_type))\n            attribute_count = int(attribute[1:-1])\n            attribute_dtype = attribute[-1]\n            if attribute_dtype == \"f\":\n                attribute_dtype = p3d.Geom.NT_float32\n            elif attribute_dtype == \"I\":\n                attribute_dtype = p3d.Geom.NT_uint32\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute data type: {}.\".format(attribute_dtype))\n            vertex_array_format.addColumn(attribute_type_name, attribute_count, attribute_dtype, attribute_type)\n        vertex_format.addArray(vertex_array_format)\n\n    else:\n        vertex_format = p3d.GeomVertexFormat()\n        vertex_format.add_array(p3d.GeomVertexFormat.getV3().arrays[0])\n        attribute_count = 1\n        if self.colors is not None and len(self.colors) > 0:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('color', 4, p3d.Geom.NT_float32, p3d.Geom.C_color))\n            color_attribute_index = attribute_count\n            attribute_count += 1\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('texcoord', 2, p3d.Geom.NT_float32, p3d.Geom.C_texcoord))\n            uv_attribute_index = attribute_count\n            attribute_count += 1\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('normal', 3, p3d.Geom.NT_float32, p3d.Geom.C_normal))\n            normal_attribute_index = attribute_count\n            attribute_count += 1\n\n    vertex_format = p3d.GeomVertexFormat.register_format(vertex_format)\n    vdata = p3d.GeomVertexData('vertex_data', vertex_format, static_mode)\n\n    if self.vertex_buffer is not None:\n        m = memoryview(self.vertex_buffer).cast('B')\n        vdata.unclean_set_num_rows(self.vertex_buffer_length)\n        array_handle = vdata.modify_array(0)\n        vmem = memoryview(array_handle).cast('B')\n        vmem[:] = m\n\n    else:\n        if isinstance(self.vertices[0], numbers.Real):\n            vdata.unclean_set_num_rows(len(self.vertices) // 3)\n        else:\n            vdata.unclean_set_num_rows(len(self.vertices))\n\n        self._set_array_data(vdata.modify_array(0), self._ravel(self.vertices), 'f')\n\n        if self.colors is not None and len(self.colors) > 0:\n            self._set_array_data(vdata.modify_array(color_attribute_index), self._ravel(self.colors), 'f')\n\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(uv_attribute_index), self._ravel(self.uvs), 'f')\n\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(normal_attribute_index), self._ravel(self.normals), 'f')\n\n    geom = p3d.Geom(vdata)\n    self.geom = geom\n\n    if len(self.triangles) == 0:    # no triangles provided, so just add them in order\n        prim = Mesh._modes[self.mode](static_mode)\n        prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n        parray = prim.modify_vertices()\n        n = len(self.vertices)\n        if isinstance(self.vertices[0], numbers.Real):\n            n = n // 3\n        triangles = [i for i in range(n)]\n        parray.unclean_set_num_rows(n)\n        self._set_array_data(parray, triangles, 'I')\n\n        prim.close_primitive()\n        geom.addPrimitive(prim)\n\n    else:\n        if not isinstance(self.triangles[0], numbers.Real): # triangles provided as [(0,1,2), (3,4,5,6), ...] etc., so unpack them\n            line_segments = []\n            indices = self.indices\n            for tup in self.triangles:\n                if len(tup) == 2:\n                    line_segments.append(tup)\n\n\n            for line_segment in line_segments:\n                prim = Mesh._modes['line'](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(line_segment))\n                self._set_array_data(parray, line_segment, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n            if len(indices) > 0:\n                prim = Mesh._modes[self.mode](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(indices))\n                self._set_array_data(parray, indices, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n        else:   # got triangles as [0,1,2,3,4,5], ie. flat\n            prim = Mesh._modes[self.mode](static_mode)\n            prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n            parray = prim.modify_vertices()\n\n            parray.unclean_set_num_rows(len(self.triangles))\n            self._set_array_data(parray, self._ravel(self.triangles), 'I')\n\n            prim.close_primitive()\n            geom.addPrimitive(prim)\n\n    self.geomNode.addGeom(geom)\n\n    if self.mode == 'point':\n        self.setTexGen(p3d.TextureStage.getDefault(), p3d.TexGenAttrib.MPointSprite)\n",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Project function reference, panda3d",
      "display": "mesh.py · generate()",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project repository, panda3d",
      "display": "pokepetter/ursina",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project stars, pokepetter/ursina",
      "display": "2.6K",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project push date, pokepetter/ursina",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F75": {
      "label": "Library name, arcade",
      "display": "Arcade",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Monthly downloads, arcade",
      "display": "21.2K",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "License, arcade",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Package release, arcade",
      "display": "3.3.3, Oct 2025",
      "asOf": "2025-10-09"
    },
    "F79": {
      "label": "Package release date, arcade",
      "display": "Oct 2025",
      "asOf": "2025-10-09"
    },
    "F80": {
      "label": "Repository stars, arcade",
      "display": "2.1K",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "Sprite rendering, arcade",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Collision checks, arcade",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Audio playback, arcade",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Install, arcade",
      "display": "pip install arcade",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "What it does, arcade",
      "display": "Provides a Python framework for two-dimensional games with sprites and collision tools.",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "strengths lead, arcade",
      "display": "Batches sprite drawing",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths, arcade",
      "display": "Draw SpriteList collections together through the graphics processor.",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "strengths lead, arcade",
      "display": "Hashes static sprite collisions",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths, arcade",
      "display": "Enable spatial hashing for collision checks against non-moving sprite lists.",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "limitations lead, arcade",
      "display": "Targets desktop graphics hardware",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "limitations, arcade",
      "display": "Web and mobile are currently unsupported.",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "limitations lead, arcade",
      "display": "Moving sprites weaken spatial hashing",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "limitations, arcade",
      "display": "Reserve spatial hashing for sprite lists that mostly stay still.",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Quickstart, arcade",
      "display": "\"\"\"\nMinimal Sprite Example\n\nDraws a single sprite in the middle screen.\n\nIf Python and Arcade are installed, this example can be run from the command line with:\npython -m arcade.examples.sprite_minimal\n\"\"\"\nimport arcade\n\n\nclass GameView(arcade.View):\n\n    def __init__(self):\n        super().__init__()\n        # 1. Create the SpriteList\n        self.sprites = arcade.SpriteList()\n\n        # 2. Create & append your Sprite instance to the SpriteList\n        self.circle = arcade.Sprite()  # Sprite with the default texture\n        self.circle.position = self.center  # center sprite on screen\n        self.sprites.append(self.circle)  # Append the instance to the SpriteList\n\n    def on_draw(self):\n        # 3. Clear the screen\n        self.clear()\n\n        # 4. Call draw() on the SpriteList inside an on_draw() method\n        self.sprites.draw()\n\n\ndef main():\n    \"\"\" Main function \"\"\"\n    # Create a window class. This is what actually shows up on screen\n    window = arcade.Window(1280, 720, \"Minimal SPrite Example\")\n\n    # Create and setup the GameView\n    game = GameView()\n\n    # Show GameView on screen\n    window.show_view(game)\n\n    # Start the arcade game loop\n    arcade.run()\n\n\nif __name__ == \"__main__\":\n    main()\n",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Project function, arcade",
      "display": "def on_update(self, delta_time: float):\n    \"\"\"Update all the game objects\n\n    Arguments:\n        delta_time {float} -- How many seconds since the last frame?\n    \"\"\"\n\n    # Check if you've picked up a coin\n    coins_hit = arcade.check_for_collision_with_list(\n        sprite=self.player, sprite_list=self.coins\n    )\n\n    for coin in coins_hit:\n        # Add the coin score to your score\n        self.score += COIN_VALUE\n\n        # Play the coin sound\n        arcade.play_sound(self.coin_pickup_sound)\n\n        # Remove the coin\n        coin.remove_from_sprite_lists()\n\n    # Are there more coins than allowed on the screen?\n    if len(self.coins) > COIN_COUNT:\n        # Stop adding coins\n        arcade.unschedule(function_pointer=self.add_coin)\n\n        # Show the mouse cursor\n        self.set_mouse_visible(True)\n\n        # Print the final score and exit the game\n        print(f\"Game over! Final score: {self.score}\")\n        exit()\n",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project function reference, arcade",
      "display": "arcade_game.py · on_update()",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project repository, arcade",
      "display": "realpython/materials",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Project stars, realpython/materials",
      "display": "5.2K",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Project push date, realpython/materials",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F100": {
      "label": "Developer need",
      "display": "Controlling the game loop directly",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Why choose pygame",
      "display": "explicit input, state, and drawing steps",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need in introduction",
      "display": "controlling the game loop directly",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "When to consider arcade",
      "display": "batched sprite collections fit the game",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Developer need",
      "display": "Drawing collections of game sprites",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Why choose arcade",
      "display": "batched SpriteList rendering",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need in introduction",
      "display": "drawing collections of game sprites",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "When to consider pygame",
      "display": "direct game-loop control matters more",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need",
      "display": "Working directly with OpenGL",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Why choose pyglet",
      "display": "native graphics bindings and abstractions",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need in introduction",
      "display": "working directly with OpenGL",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "When to consider panda3d",
      "display": "the project needs a full scene engine",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need",
      "display": "Building a scene-based game",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "Why choose panda3d",
      "display": "a complete scene and rendering engine",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Developer need in introduction",
      "display": "building a scene-based game",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "Page introduction",
      "display": "Python game development libraries let game developers build interactive games.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Which library gives direct control over the game loop?",
      "display": "pygame leaves execution, event processing, state updates, and drawing under application control.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Why must pygame events be processed regularly?",
      "display": "Service events every frame to avoid dropped input and an apparently unresponsive program.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Do rectangle collisions follow visible sprite outlines?",
      "display": "pygame collide_rect checks rectangles, while collide_mask uses masks.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Do rectangle collisions follow visible sprite outlines?",
      "display": "Use the mask-based operation when image shape matters.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Why use an Arcade SpriteList?",
      "display": "SpriteList batches sprite drawing and uses the graphics processor.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: When should Arcade spatial hashing be used?",
      "display": "Use it for collision checks against a list of non-moving sprites.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does Arcade currently target browsers or mobile?",
      "display": "Its installation requirements explicitly exclude web and mobile support.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Can old pyglet Batch.add code be copied into current releases?",
      "display": "Batch.add and Batch.add_indexed were removed; use ShaderProgram vertex-list APIs.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Does pyglet expose low-level rendering?",
      "display": "It exposes OpenGL through pyglet.gl and supplies higher-level rendering abstractions.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: What is required for pyglet video playback?",
      "display": "FFmpeg must be installed to play video.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Can Panda3D collision objects be mixed with Bullet bodies?",
      "display": "Bullet bodies do not collide with native CollisionNodes or ODE bodies.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: What do PNG output cells mean here?",
      "display": "pygame can save PNG image files.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: What do PNG output cells mean here?",
      "display": "pyglet supports PNG saving natively, with more formats available through Pillow.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "FAQ: Does the minimal Panda3D starter load a game scene?",
      "display": "The starter initializes ShowBase and its main loop; its initial window is empty.",
      "asOf": "2026-11-17"
    },
    "F130": {
      "label": "Library name, pygame",
      "display": "pygame",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Monthly downloads, pygame",
      "display": "2.7M",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "License, pygame",
      "display": "LGPL",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Package release, pygame",
      "display": "2.6.1",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Package release date, pygame",
      "display": "Sep 2024",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Install, pygame",
      "display": "python -m pip install pygame==2.6.1",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Quickstart, pygame",
      "display": "import pygame\n\npygame.init()\nscreen = pygame.display.set_mode((640, 480))\nrunning = True\nwhile running:\n    for event in pygame.event.get():\n        if event.type == pygame.QUIT:\n            running = False\n    screen.fill(\"black\")\n    pygame.display.flip()\npygame.quit()\n",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Spatial entity hierarchy, pygame",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Native tilemap assets, pygame",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Framework and asset model, pygame",
      "display": "Classic SDL-based Python game framework with a manual event/draw loop, Surfaces, input, and audio. Separate distribution from pygame-ce despite the shared import name.",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Project function, pygame",
      "display": "def _update_ui(self):\n    self.display.fill(BLACK)\n\n    for pt in self.snake:\n        pygame.draw.rect(self.display, BLUE1, pygame.Rect(pt.x, pt.y, BLOCK_SIZE, BLOCK_SIZE))\n        pygame.draw.rect(self.display, BLUE2, pygame.Rect(pt.x+4, pt.y+4, 12, 12))\n\n    pygame.draw.rect(self.display, RED, pygame.Rect(self.food.x, self.food.y, BLOCK_SIZE, BLOCK_SIZE))\n\n    text = font.render(\"Score: \" + str(self.score), True, WHITE)\n    self.display.blit(text, [0, 0])\n    pygame.display.flip()",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Project source file, pygame",
      "display": "game.py",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project full_name, pygame",
      "display": "patrickloeber/snake-ai-pytorch",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project stargazers_count, pygame",
      "display": "745",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Library name, pyglet",
      "display": "pyglet",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Monthly downloads, pyglet",
      "display": "2.3M",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "License, pyglet",
      "display": "BSD",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Package release, pyglet",
      "display": "2.1.19",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Package release date, pyglet",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Install, pyglet",
      "display": "python -m pip install pyglet==2.1.19",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Quickstart, pyglet",
      "display": "import pyglet\n\nwindow = pyglet.window.Window()\n\n@window.event\ndef on_draw():\n    window.clear()\n\npyglet.app.run()\n",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Spatial entity hierarchy, pyglet",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Native tilemap assets, pyglet",
      "display": "Undocumented",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Framework and asset model, pyglet",
      "display": "Python window/event/OpenGL, sprite/media, and model-loading framework. Its model/Scene/Node asset containers are not a reparentable game-entity transform system.",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Project function, pyglet",
      "display": "def __init__(self, **kwargs: Any):\n    super().__init__(**kwargs)\n\n    config = pyglet.gl.Config(\n        major_version=self.gl_version[0],\n        minor_version=self.gl_version[1],\n        forward_compatible=True,\n        red_size=8,\n        green_size=8,\n        blue_size=8,\n        alpha_size=8,\n        stencil_size=8,\n        depth_size=24,\n        double_buffer=True,\n        sample_buffers=1 if self.samples > 1 else 0,\n        samples=self.samples,\n    )\n\n    if self.fullscreen:\n        if hasattr(pyglet, 'canvas'):\n            display = pyglet.canvas.get_display()\n        else:\n            display = pyglet.display.get_display()\n        screen = display.get_default_screen()\n        self._width, self._height = screen.width, screen.height\n\n    self._window = PygletWrapper(\n        width=self._width,\n        height=self._height,\n        caption=self._title,\n        resizable=self._resizable,\n        visible=self._visible,\n        vsync=self._vsync,\n        fullscreen=self._fullscreen,\n        config=config,\n        file_drops=True and platform.system() != \"Darwin\",\n    )\n\n    self.cursor = self._cursor\n\n    self._window.event(self.on_key_press)\n    self._window.event(self.on_key_release)\n    self._window.event(self.on_mouse_motion)\n    self._window.event(self.on_mouse_drag)\n    self._window.event(self.on_resize)\n    self._window.event(self.on_close)\n    self._window.event(self.on_mouse_press)\n    self._window.event(self.on_mouse_release)\n    self._window.event(self.on_mouse_scroll)\n    self._window.event(self.on_text)\n    self._window.event(self.on_show)\n    self._window.event(self.on_hide)\n    self._window.event(self.on_file_drop)\n\n    self.init_mgl_context()\n    self._buffer_width, self._buffer_height = self._window.get_framebuffer_size()\n    self.set_default_viewport()",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Project source file, pyglet",
      "display": "moderngl_window/context/pyglet/window.py",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Project full_name, pyglet",
      "display": "moderngl/moderngl-window",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Project stargazers_count, pyglet",
      "display": "280",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Library name, pygame-ce",
      "display": "pygame-ce",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Monthly downloads, pygame-ce",
      "display": "776.6K",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "License, pygame-ce",
      "display": "LGPL-2.1",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Package release, pygame-ce",
      "display": "2.5.8",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Package release date, pygame-ce",
      "display": "Aug 2026",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Install, pygame-ce",
      "display": "python -m pip install pygame-ce==2.5.8",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Quickstart, pygame-ce",
      "display": "import pygame\n\nsurface = pygame.Surface((640, 480))\nsurface.fill(\"black\")\n",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Official description, pygame-ce",
      "display": "Develops games in Python through a community fork of pygame.",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Quickstart source file, pygame-ce",
      "display": "surface.html",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Spatial entity hierarchy, pygame-ce",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Native tilemap assets, pygame-ce",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Framework and asset model, pygame-ce",
      "display": "Separately published community fork exposing the pygame import and Surface/game APIs. Consumer manifests establish which distribution a project actually uses.",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Project function, pygame-ce",
      "display": "def render(self):\n    if self.render_mode is None:\n        assert self.spec is not None\n        gym.logger.warn(\n            \"You are calling render method without specifying any render mode. \"\n            \"You can specify the render_mode at initialization, \"\n            f'e.g. gym.make(\"{self.spec.id}\", render_mode=\"rgb_array\")'\n        )\n        return\n\n    try:\n        import pygame\n        from pygame import gfxdraw\n    except ImportError as e:\n        raise DependencyNotInstalled(\n            'pygame is not installed, run `pip install \"gymnasium[classic-control]\"`'\n        ) from e\n\n    if self.screen is None:\n        pygame.display.init()\n        if self.render_mode == \"human\":\n            self.screen = pygame.display.set_mode(\n                (self.screen_width, self.screen_height)\n            )\n        else:  # mode == \"rgb_array\"\n            self.screen = pygame.Surface((self.screen_width, self.screen_height))\n    if self.clock is None:\n        self.clock = pygame.time.Clock()\n\n    world_width = self.x_threshold * 2\n    scale = self.screen_width / world_width\n    polewidth = 10.0\n    polelen = scale * (2 * self.length)\n    cartwidth = 50.0\n    cartheight = 30.0\n\n    if self.state is None:\n        return None\n\n    x = self.state\n\n    self.surf = pygame.Surface((self.screen_width, self.screen_height))\n    self.surf.fill((255, 255, 255))\n\n    l, r, t, b = -cartwidth / 2, cartwidth / 2, cartheight / 2, -cartheight / 2\n    axleoffset = cartheight / 4.0\n    cartx = x[0] * scale + self.screen_width / 2.0  # MIDDLE OF CART\n    carty = 100  # TOP OF CART\n    cart_coords = [(l, b), (l, t), (r, t), (r, b)]\n    cart_coords = [(c[0] + cartx, c[1] + carty) for c in cart_coords]\n    gfxdraw.aapolygon(self.surf, cart_coords, (0, 0, 0))\n    gfxdraw.filled_polygon(self.surf, cart_coords, (0, 0, 0))\n\n    l, r, t, b = (\n        -polewidth / 2,\n        polewidth / 2,\n        polelen - polewidth / 2,\n        -polewidth / 2,\n    )\n\n    pole_coords = []\n    for coord in [(l, b), (l, t), (r, t), (r, b)]:\n        coord = pygame.math.Vector2(coord).rotate_rad(-x[2])\n        coord = (coord[0] + cartx, coord[1] + carty + axleoffset)\n        pole_coords.append(coord)\n    gfxdraw.aapolygon(self.surf, pole_coords, (202, 152, 101))\n    gfxdraw.filled_polygon(self.surf, pole_coords, (202, 152, 101))\n\n    gfxdraw.aacircle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n    gfxdraw.filled_circle(\n        self.surf,\n        int(cartx),\n        int(carty + axleoffset),\n        int(polewidth / 2),\n        (129, 132, 203),\n    )\n\n    gfxdraw.hline(self.surf, 0, self.screen_width, carty, (0, 0, 0))\n\n    self.surf = pygame.transform.flip(self.surf, False, True)\n    self.screen.blit(self.surf, (0, 0))\n    if self.render_mode == \"human\":\n        pygame.event.pump()\n        self.clock.tick(self.metadata[\"render_fps\"])\n        pygame.display.flip()\n\n    elif self.render_mode == \"rgb_array\":\n        return np.transpose(\n            np.array(pygame.surfarray.pixels3d(self.screen)), axes=(1, 0, 2)\n        )",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Project source file, pygame-ce",
      "display": "gymnasium/envs/classic_control/cartpole.py",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Project full_name, pygame-ce",
      "display": "Farama-Foundation/Gymnasium",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Project stargazers_count, pygame-ce",
      "display": "12.8K",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project function, pygame-ce",
      "display": "def apply_colour_to_surface(\n    colour: pygame.Color,\n    shape_surface: pygame.surface.Surface,\n    rect: Union[pygame.Rect, None] = None,\n):\n    \"\"\"\n    Apply a colour to a shape surface by multiplication blend. This works best when the shape\n    surface is predominantly white.\n\n    :param colour: The colour to apply.\n    :param shape_surface: The shape surface to apply the colour to.\n    :param rect: A rectangle to apply the colour inside.\n\n    \"\"\"\n    if rect is not None:\n        colour_surface = pygame.surface.Surface(\n            rect.size, flags=pygame.SRCALPHA, depth=32\n        )\n        colour_surface.fill(colour)\n        shape_surface.blit(colour_surface, rect, special_flags=pygame.BLEND_RGBA_MULT)\n    else:\n        colour_surface = pygame.surface.Surface(\n            shape_surface.get_size(), flags=pygame.SRCALPHA, depth=32\n        )\n        colour_surface.fill(colour)\n        shape_surface.blit(colour_surface, (0, 0), special_flags=pygame.BLEND_RGBA_MULT)",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project source file, pygame-ce",
      "display": "pygame_gui/core/utility.py",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Project full_name, pygame-ce",
      "display": "MyreMylar/pygame_gui",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project stargazers_count, pygame-ce",
      "display": "816",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Library name, panda3d",
      "display": "Panda3D",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Monthly downloads, panda3d",
      "display": "210.5K",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "License, panda3d",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Package release, panda3d",
      "display": "1.10.16",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Package release date, panda3d",
      "display": "Dec 2025",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Install, panda3d",
      "display": "python -m pip install panda3d==1.10.16",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Quickstart, panda3d",
      "display": "from direct.showbase.ShowBase import ShowBase\n\napp = ShowBase()\napp.run()\n",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Spatial entity hierarchy, panda3d",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Native tilemap assets, panda3d",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Framework and asset model, panda3d",
      "display": "C++/Python game engine with a live NodePath scene graph, transforms, model loading, and geometry/buffer APIs; lower-level backend for Ursina.",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Project function, panda3d",
      "display": "def generate(self): # Must be called after a mesh's values has been updated in order to update visually\n    self._generated_vertices = None\n\n    if hasattr(self, 'geomNode'):\n        self.geomNode.removeAllGeoms()\n    else:\n        self.geomNode = p3d.GeomNode('mesh_geom')\n        self.attachNewNode(self.geomNode)\n\n    if len(self.vertices) == 0 and self.vertex_buffer is None:\n        return\n\n    static_mode = p3d.Geom.UHStatic if self.static else p3d.Geom.UHDynamic\n    vertex_format = p3d.GeomVertexFormat()\n\n    color_attribute_index = -1\n    uv_attribute_index = -1\n    normal_attribute_index = -1\n\n    if self.vertex_buffer is not None:\n        vertex_array_format = p3d.GeomVertexArrayFormat()\n        attributes = self.vertex_buffer_format.split(\",\")\n        for attribute in attributes:\n            attribute_type = attribute[0]\n            attribute_type_name = attribute[0]\n            if attribute_type == \"p\":\n                attribute_type = p3d.Geom.C_point\n                attribute_type_name = \"vertex\"\n            elif attribute_type == \"c\":\n                attribute_type = p3d.Geom.C_color\n                attribute_type_name = \"color\"\n            elif attribute_type == \"t\":\n                attribute_type = p3d.Geom.C_texcoord\n                attribute_type_name = \"texcoord\"\n            elif attribute_type == \"n\":\n                attribute_type = p3d.Geom.C_normal\n                attribute_type_name = \"normal\"\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute type: {}.\".format(attribute_type))\n            attribute_count = int(attribute[1:-1])\n            attribute_dtype = attribute[-1]\n            if attribute_dtype == \"f\":\n                attribute_dtype = p3d.Geom.NT_float32\n            elif attribute_dtype == \"I\":\n                attribute_dtype = p3d.Geom.NT_uint32\n            else:\n                raise Exception(\"Invalid vertex buffer format attribute data type: {}.\".format(attribute_dtype))\n            vertex_array_format.addColumn(attribute_type_name, attribute_count, attribute_dtype, attribute_type)\n        vertex_format.addArray(vertex_array_format)\n\n    else:\n        vertex_format = p3d.GeomVertexFormat()\n        vertex_format.add_array(p3d.GeomVertexFormat.getV3().arrays[0])\n        attribute_count = 1\n        if self.colors is not None and len(self.colors) > 0:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('color', 4, p3d.Geom.NT_float32, p3d.Geom.C_color))\n            color_attribute_index = attribute_count\n            attribute_count += 1\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('texcoord', 2, p3d.Geom.NT_float32, p3d.Geom.C_texcoord))\n            uv_attribute_index = attribute_count\n            attribute_count += 1\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            vertex_format.add_array(p3d.GeomVertexArrayFormat('normal', 3, p3d.Geom.NT_float32, p3d.Geom.C_normal))\n            normal_attribute_index = attribute_count\n            attribute_count += 1\n\n    vertex_format = p3d.GeomVertexFormat.register_format(vertex_format)\n    vdata = p3d.GeomVertexData('vertex_data', vertex_format, static_mode)\n\n    if self.vertex_buffer is not None:\n        m = memoryview(self.vertex_buffer).cast('B')\n        vdata.unclean_set_num_rows(self.vertex_buffer_length)\n        array_handle = vdata.modify_array(0)\n        vmem = memoryview(array_handle).cast('B')\n        vmem[:] = m\n\n    else:\n        if isinstance(self.vertices[0], numbers.Real):\n            vdata.unclean_set_num_rows(len(self.vertices) // 3)\n        else:\n            vdata.unclean_set_num_rows(len(self.vertices))\n\n        self._set_array_data(vdata.modify_array(0), self._ravel(self.vertices), 'f')\n\n        if self.colors is not None and len(self.colors) > 0:\n            self._set_array_data(vdata.modify_array(color_attribute_index), self._ravel(self.colors), 'f')\n\n        if self.uvs is not None and len(self.uvs) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(uv_attribute_index), self._ravel(self.uvs), 'f')\n\n        if self.normals is not None and len(self.normals) > 0 and self.mode not in ['line', 'point']:\n            self._set_array_data(vdata.modify_array(normal_attribute_index), self._ravel(self.normals), 'f')\n\n    geom = p3d.Geom(vdata)\n    self.geom = geom\n\n    if len(self.triangles) == 0:    # no triangles provided, so just add them in order\n        prim = Mesh._modes[self.mode](static_mode)\n        prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n        parray = prim.modify_vertices()\n        n = len(self.vertices)\n        if isinstance(self.vertices[0], numbers.Real):\n            n = n // 3\n        triangles = [i for i in range(n)]\n        parray.unclean_set_num_rows(n)\n        self._set_array_data(parray, triangles, 'I')\n\n        prim.close_primitive()\n        geom.addPrimitive(prim)\n\n    else:\n        if not isinstance(self.triangles[0], numbers.Real): # triangles provided as [(0,1,2), (3,4,5,6), ...] etc., so unpack them\n            line_segments = []\n            indices = self.indices\n            for tup in self.triangles:\n                if len(tup) == 2:\n                    line_segments.append(tup)\n\n\n            for line_segment in line_segments:\n                prim = Mesh._modes['line'](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(line_segment))\n                self._set_array_data(parray, line_segment, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n            if len(indices) > 0:\n                prim = Mesh._modes[self.mode](static_mode)\n                prim.set_index_type(p3d.GeomEnums.NT_uint32)\n                parray = prim.modify_vertices()\n                parray.unclean_set_num_rows(len(indices))\n                self._set_array_data(parray, indices, 'I')\n                prim.close_primitive()\n                geom.addPrimitive(prim)\n\n        else:   # got triangles as [0,1,2,3,4,5], ie. flat\n            prim = Mesh._modes[self.mode](static_mode)\n            prim.set_index_type(p3d.GeomEnums.NT_uint32)\n\n            parray = prim.modify_vertices()\n\n            parray.unclean_set_num_rows(len(self.triangles))\n            self._set_array_data(parray, self._ravel(self.triangles), 'I')\n\n            prim.close_primitive()\n            geom.addPrimitive(prim)\n\n    self.geomNode.addGeom(geom)\n\n    if self.mode == 'point':\n        self.setTexGen(p3d.TextureStage.getDefault(), p3d.TexGenAttrib.MPointSprite)",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Project source file, panda3d",
      "display": "ursina/mesh.py",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project full_name, panda3d",
      "display": "pokepetter/ursina",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project stargazers_count, panda3d",
      "display": "2.6K",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Library name, ursina",
      "display": "Ursina",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Monthly downloads, ursina",
      "display": "71.7K",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "License, ursina",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Package release, ursina",
      "display": "8.3.0",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Package release date, ursina",
      "display": "Dec 2025",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Install, ursina",
      "display": "python -m pip install ursina==8.3.0",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Quickstart, ursina",
      "display": "from ursina import Ursina, Entity\n\napp = Ursina()\ncube = Entity(model=\"cube\")\napp.run()\n",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Official description, ursina",
      "display": "Provides a game engine and framework for Python.",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Quickstart source file, ursina",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Spatial entity hierarchy, ursina",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Native tilemap assets, ursina",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Framework and asset model, ursina",
      "display": "Python Entity/prefab game framework built on Panda3D, with parented entity transforms and an image-based Tilemap prefab.",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Library name, arcade",
      "display": "Arcade",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Monthly downloads, arcade",
      "display": "21.6K",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "License, arcade",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Package release, arcade",
      "display": "3.3.3",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Package release date, arcade",
      "display": "Oct 2025",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Install, arcade",
      "display": "python -m pip install arcade==3.3.3",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Quickstart, arcade",
      "display": "import arcade\n\nwindow = arcade.Window(640, 480, \"Example\")\n\n@window.event\ndef on_draw():\n    window.clear()\n\narcade.run()\n",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Spatial entity hierarchy, arcade",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Native tilemap assets, arcade",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Framework and asset model, arcade",
      "display": "Python game framework centered on Window/View, SpriteLists, game callbacks, sound, and Tiled map loading; distinct from direct OpenGL/SDL bindings.",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Project function, arcade",
      "display": "def on_update(self, delta_time: float):\n    \"\"\"Update all the game objects\n\n    Arguments:\n        delta_time {float} -- How many seconds since the last frame?\n    \"\"\"\n\n    # Check if you've picked up a coin\n    coins_hit = arcade.check_for_collision_with_list(\n        sprite=self.player, sprite_list=self.coins\n    )\n\n    for coin in coins_hit:\n        # Add the coin score to your score\n        self.score += COIN_VALUE\n\n        # Play the coin sound\n        arcade.play_sound(self.coin_pickup_sound)\n\n        # Remove the coin\n        coin.remove_from_sprite_lists()\n\n    # Are there more coins than allowed on the screen?\n    if len(self.coins) > COIN_COUNT:\n        # Stop adding coins\n        arcade.unschedule(function_pointer=self.add_coin)\n\n        # Show the mouse cursor\n        self.set_mouse_visible(True)\n\n        # Print the final score and exit the game\n        print(f\"Game over! Final score: {self.score}\")\n        exit()",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Project source file, arcade",
      "display": "top-python-game-engines/arcade/arcade_game.py",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Project full_name, arcade",
      "display": "realpython/materials",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Project stargazers_count, arcade",
      "display": "5.2K",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Library name, pyxel",
      "display": "Pyxel",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Monthly downloads, pyxel",
      "display": "20.2K",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "License, pyxel",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Package release, pyxel",
      "display": "3.0.2",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Package release date, pyxel",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Install, pyxel",
      "display": "python -m pip install pyxel==3.0.2",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Quickstart, pyxel",
      "display": "import pyxel\n\ndef update():\n    if pyxel.btnp(pyxel.KEY_Q):\n        pyxel.quit()\n\ndef draw():\n    pyxel.cls(0)\n    pyxel.text(5, 5, \"Hello\", 7)\n\npyxel.init(160, 120)\npyxel.run(update, draw)\n",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Official description, pyxel",
      "display": "Provides a retro game engine for Python.",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Quickstart source file, pyxel",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Spatial entity hierarchy, pyxel",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Native tilemap assets, pyxel",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Framework and asset model, pyxel",
      "display": "Retro game engine with its own pixel/bitmap/tilemap and sound resource workflow plus a bundled asset editor; a distinct workflow from general window frameworks.",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python game development libraries pygame Arcade pyglet Panda3D code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
