GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — EzPyGame/README.md at master · Mahi/EzPyGame

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
51 lines (35 loc) · 1.24 KB
/

README.md

Copy path

File metadata and controls

51 lines (35 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

EzPyGame

EzPyGame aims to make the usage of pygame easier and more pythonic than before. It implements easy scene management tools and an application class for initializing pygame and running scenes easily.

Installation

pip install ezpygame

Quick start

Create scenes by subclassing ezpygame.Scene and overriding any of the following methods:

  • handle_event(self, event)
  • draw(self, screen)
  • update(self, dt)
  • on_enter(self, previous_scene)
  • on_exit(self, next_scene)

Now create an ezpygame.Application instance and start the execution from any scene:

app = ezpygame.Application(
    title='My First EzPyGame Application!',
    resolution=(1280, 720),
    update_rate=60,
)
main_menu = MenuScene()
app.run(main_menu)

Scenes can be switched by using the Application.change_scene(scene) method:

class Game(Scene):
    ...

    def on_enter(self, previous_scene):
        self.previous_scene = previous_scene

    def update(self, dt):
        self.player.move(dt)
        if self.player.died():
            self.application.change_scene(self.previous_scene)

Reference documentation

With more in-depth guide and examples: https://ezpygame.readthedocs.io/

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.