Linux command
pygbag 命令
趣味
复制后可按需替换文件名、目录或参数。
常用示例
Package game for web
pygbag [path/to/game]
Specify output directory
pygbag --build [path/to/game]
Run development server
pygbag --dev [path/to/game]
Custom archive name
pygbag --archive [name] [path/to/game]
Specify custom port for dev server
pygbag --port [8000] [path/to/game]
Specify template
pygbag --template [template.html] [path/to/game]
说明
pygbag packages Pygame applications for deployment in web browsers by compiling Python code to WebAssembly using Emscripten and Pyodide. The resulting build runs directly in modern browsers without plugins, making it straightforward to share Python games and multimedia applications online. The tool includes a built-in development server for local testing before deployment. Games must use async Python patterns with asyncio to work within the browser's event loop model. pygbag handles asset bundling, HTML template generation, and the WebAssembly compilation pipeline, producing a self-contained web application from a standard Pygame project.
参数
- --build
- Build only, no server.
- --dev
- Development mode.
- --archive _NAME_
- Archive filename.
- --template _FILE_
- Custom HTML template.
- --port _PORT_
- Port for the development server (default: 8000).
- --cdn _URL_
- CDN base URL.
- --title _TITLE_
- Page title.
- --ume_block _SIZE_
- Set the maximum cache block size.
FAQ
What is the pygbag command used for?
pygbag packages Pygame applications for deployment in web browsers by compiling Python code to WebAssembly using Emscripten and Pyodide. The resulting build runs directly in modern browsers without plugins, making it straightforward to share Python games and multimedia applications online. The tool includes a built-in development server for local testing before deployment. Games must use async Python patterns with asyncio to work within the browser's event loop model. pygbag handles asset bundling, HTML template generation, and the WebAssembly compilation pipeline, producing a self-contained web application from a standard Pygame project.
How do I run a basic pygbag example?
Run `pygbag [path/to/game]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --build do in pygbag?
Build only, no server.