英文:
how to compile a project on fyne and golang with images?
问题
我有一个项目,其中我使用函数"file.Load Resource From Path("resources/img/planets/mercury.png")"上传图像,但是当我尝试使用命令"fyne-cross windows -arch=*"编译项目并从当前目录传输EXE文件时,我的程序中的图片无法显示。
我执行了"go build main.go"和"fyne-cross windows -arch=386",但我不知道我可以做什么。
英文:
I have a project where I upload images with the function: "file.Load Resource From Path("resources/img/planets/mercury.png")", but when I try to compile the project with the command: "fyne-cross windows -arch=*" and transfer the EXE FILE where from the current directory, the pictures in my program are not displayed
go build main.go, fyne-cross windows -arch=386
I don't know what I can doing
答案1
得分: 1
“resources”文件夹只是你的源代码的一部分。Fyne(就像Go一样)应用程序是单个二进制文件,不会与资源一起分发。如果你想包含这样的项目,你应该将它们捆绑在一起 - 使用“fyne bundle”或“go embed”可以为你解决这个问题。
英文:
The “resources” folder is just part of your source code. Fyne (like Go) apps are single binaries and not distributed with assets. If you want to include items like that you should bundle them - “fyne bundle” or “go embed” will sort this for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论