Neither pyglet nor pygame will run in a browser. I wouldn’t really recommend using Python at all if you target is a web browser. JavaScript (with HTML5 Canvas), Flash, or Java applets are is better suited for that environment.
If you’re dedicated to the idea of using Python, there are a number of projects that can compile Python into JavaScript. There are some mentioned on the Python wiki. Here are a few:
- Skulpt
- Pyjamas
- Pyjaco
You’ll need to write your own graphics and audio systems, though, since none of those projects can convert the native code needed by pyglet and pygame into JavaScript.