Search code examples
pythonpycharmpanda3d

What is the path of Config.prc files in Panda3D


I am new in Panda3D and I want to change my window size to fullscreen through .prc files. How can I do it?


Solution

  • From the documentation: https://raw.githubusercontent.com/panda3d/panda3d/release/1.10.x/panda/src/doc/howto.use_config.txt

    In its default mode, when Panda starts up it will search in the install/etc directory (or in the directory named by the environment variable PRC_DIR if it is set) for all files named *.prc (that is, any files with an extension of "prc") and read each of them for runtime configuration. (It is possible to change this default behavior; see COMPILE-TIME OPTIONS FOR FINDING PRC FILES, below.)

    To access config variables from your program read up on this resource: https://docs.panda3d.org/1.10/python/programming/configuration/accessing-config-vars-in-a-program

    You can use the loadPrcFile function to load your custom config file with a specified path:

    from panda3d.core import loadPrcFile
    loadPrcFile("config/Config.prc")
    

    To only change one variable such as making your window fullscreen use the loadPrcFileData function:

    from panda3d.core import loadPrcFileData
    loadPrcFileData('', 'fullscreen true')