Code Monkey home page Code Monkey logo

Comments (5)

github-actions avatar github-actions commented on September 27, 2024

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 27, 2024

I see you are referencing "enter.jpg" in your script - since this is a relative reference, it will resolve relatively to the current working directory, which will most likely not be where the file is actually being stored in the bundle output.

To fix this, you need to wrap file references with resource_path to correctly turn a relative path into an absolute path which will point to the correct file. For example,

icon.addPixmap(QtGui.QPixmap(resource_path("enter.jpg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)

You can read more about this in the help post under "The one-file Resource Wrapper".

from auto-py-to-exe.

shlomiz89 avatar shlomiz89 commented on September 27, 2024

Thank you very much for fast answer

should i write this code into my code?

i mentioned this in the class before setupUi def

def resource_path(relative_path):
    import sys, os
    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
    except Exception:
        base_path = os.path.abspath(".")

    return os.path.join(base_path, relative_path)

and reference it in
icon.addPixmap(QtGui.QPixmap(resource_path("enter.jpg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)

i receive an error - undefined name "resource_path"

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 27, 2024

Yes, you need to add that function yourself. Nothing provides it for you and this tool doesn't add anything to your application.

from auto-py-to-exe.

shlomiz89 avatar shlomiz89 commented on September 27, 2024

you the besttttt!!!!!!!
thank you <3

from auto-py-to-exe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.