Hide Ren'Py web hamburger menu

• Home • Edit


This post explains how to hide the hamburger menu that appears in the top-left corner of a Ren’Py web game.

CSS

If you created your web build with the Ren’Py Launcher, you can hide the menu by adding a CSS rule to the web build’s index.html:

<style>
  #ContextContainer {
    display: none;
  }
</style>

You can also use sed to update the rule:

sed -i 's|#ContextContainer {|#ContextContainer { display: none;|' web/index.html

Make sure to replace web with your web build destination.

On macOS, use:

sed -i '' 's|#ContextContainer {|#ContextContainer { display: none;|' web/index.html

JavaScript

To hide the menu from game/script.rpy, run this JavaScript code:

label start:
    if renpy.emscripten:
        $ renpy.emscripten.run_script(
            "document.getElementById('ContextContainer').style.display = 'none'"
        )

renpy.emscripten checks whether the game is running in a web build. renpy.emscripten.run_script executes the JavaScript that hides the menu.

See example.