pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.22k stars 326 forks source link

Image not included in ursina program while converting from .py to .exe #578

Closed Sonarjit closed 10 months ago

Sonarjit commented 1 year ago

A simple usrina program to show cube entity and some image. While running the app from the terminal, the cube entity along with the images are show perfectly. Here is the image while running from terminal

Screenshot (983)

Then I created a .exe file using 'auto-py-to-exe' for the same application. While running the exe file, only the cube entity is show and the images are disappeared from the screen. Here is the image while running the exe file

Screenshot (981)

Program Code

from ursina import *
app = Ursina(title="App", borderless=False, fullscreen=False)
window.editor_ui.disable()
window.color=color.yellow

class c_1(Entity):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        parent_entity=Entity(parent=camera.ui,enabled=True)

        Entity(model='cube',parent=parent_entity,color=color.red,texture='white_cube',scale=0.2,
            position=(-0.5,0),rotation=(45,45,0))

        Sprite('assets/arrow.png',parent=parent_entity,scale=0.07,position=(0,0))

        Entity(model='quad',parent=parent_entity,texture='assets/down.png',scale=0.3,position=(0.5,0))
c_1()
app.run()

Here you can see the files and directory of the working environment

Screenshot (984)

Folder included in compiling the program

My_python_package\Lib\site-packages\direct

My_python_package\Lib\site-packages\panda3d

My_python_package\Lib\site-packages\panda3d-1.10.13.post1.dist-info

My_python_package\Lib\site-packages\ursina

My_python_package\Lib\site-packages\ursina

Root_folder\assets

[NOTE: My_python_package is the directory where python is installed in my system. And Root_folder is the root directory where the assets package is present]

Expectation Expect to show the images in the application when it is run from exe file as the images are show when it is run from the terminal.

Thanks

pokepetter commented 1 year ago

I think 'auto-py-to-exe' requires a special way to be able to load assets. In any case, sounds like a 'auto-py-to-exe' issue, not an ursina one. Is there a way to get the error from when it fails to load the texture?