pygbag icon indicating copy to clipboard operation
pygbag copied to clipboard

I need a way to generate a direct html file that can run directly in the browser, rather than publish it to itch.io

Open Python-ZZY opened this issue 2 years ago • 6 comments

All I had to do was double-click on one of the resulting files, and I was able to open it in my default browser, and the program worked fine. How do I do like this? I couldn't ask on discord due to network issues, thanks for your response.

Python-ZZY avatar Mar 11 '23 11:03 Python-ZZY

This functionnality will only be available around release v1 when everything is stable. a POC is available here with a much smaller python.

pmp-p avatar Mar 11 '23 12:03 pmp-p

This functionnality will only be available around release v1 when everything is stable. a POC is available here with a much smaller python.

thanks but how to use it?

Python-ZZY avatar Mar 12 '23 03:03 Python-ZZY

To be honest it's quite complicated hence keeping that for the end, if you don't get it by yourself meanwhile : you will have to wait.

pmp-p avatar Mar 12 '23 19:03 pmp-p

This is a workaround

  1. Run pygbag with --build and --html to generate html
  2. download files from the cdn and recreate the path locally in your build/web folder
    archives
    └── repo
        ├── index-bi.json
        ├── pkg
        │   └── pygame_static-1.0-cp311-cp311-wasm32_bi_emscripten.whl
        └── repodata.json
    
  3. Start a python web server, python -m http.server 8080
  4. Navigate to server and click the index.html file

e-dong avatar Jan 13 '24 03:01 e-dong

Is there any new information on the issue? I would like to use my pygame application without having to connect to the internet every time I launch it.

Sinus44 avatar May 30 '24 12:05 Sinus44

@Sinus44 what you want can be achieved without getting in problems running from file:// introduces. You just would have to make a template for a "service worker" than can serve file from cache without connexion or an installable "progressive web app"

those can be done as extensions to current pygbag with templates

pmp-p avatar May 30 '24 15:05 pmp-p