py2exe issues with pictures and icons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexnb

    py2exe issues with pictures and icons


    Hello

    I am sure most of you are familiar with py2exe. I am having a bit of a
    problem. See the program has a few pictures involved and the .ico it uses
    for the windows. However, the pictures are stored in the same directory as
    the source, something like: C:\Docs and settings\me\My docs\python\pro gram.
    When I run the program for the interpreter, just as a .py, everything works
    just as it should. However, when I compile the main source as an .exe, and
    say let a friend try the program. It fails because it is missing the .ico.
    The catch, is I don't want to have it have to installed, at least at this
    point, I want it to be able to just run. So how can I make it just run from
    any computer with the files not being in the immediate directory. If that is
    not possible, how can I put them in the immediate directory and still make
    it work. Because that directory may change a lot so the path will change.

    Just a few questions. I hope someone out there can help me out!
    --
    View this message in context: http://www.nabble.com/py2exe-issues-...p18493908.html
    Sent from the Python - python-list mailing list archive at Nabble.com.

  • Mike Driscoll

    #2
    Re: py2exe issues with pictures and icons

    On Jul 16, 1:37 pm, Alexnb <alexnbr...@gma il.comwrote:
    Hello
    >
    I am sure most of you are familiar with py2exe. I am having a bit of a
    problem. See the program has a few pictures involved and the .ico it uses
    for the windows. However, the pictures are stored in the same directory as
    the source, something like: C:\Docs and settings\me\My docs\python\pro gram.
    When I run the program for the interpreter, just as a .py, everything works
    just as it should. However, when I compile the main source as an .exe, and
    say let a friend try the program. It fails because it is missing the .ico..
    The catch, is I don't want to have it have to installed, at least at this
    point, I want it to be able to just run. So how can I make it just run from
    any computer with the files not being in the immediate directory. If thatis
    not possible, how can I put them in the immediate directory and still make
    it work. Because that directory may change a lot so the path will change.
    >
    Just a few questions. I hope someone out there can help me out!
    --
    View this message in context:http://www.nabble.com/py2exe-issues-...cons-tp1849390...
    Sent from the Python - python-list mailing list archive at Nabble.com.

    Put the part of the code that needs the ico file(s) into a try/except
    block. You could also try reading the py2exe wiki and tutorials. This
    one looks like it has relevant data:



    Mike

    Comment

    • Alexnb

      #3
      Re: py2exe issues with pictures and icons




      Mike Driscoll wrote:

      On Jul 16, 1:37 pm, Alexnb <alexnbr...@gma il.comwrote:
      >Hello
      >>
      >I am sure most of you are familiar with py2exe. I am having a bit of a
      >problem. See the program has a few pictures involved and the .ico it uses
      >for the windows. However, the pictures are stored in the same directory
      >as
      >the source, something like: C:\Docs and settings\me\My
      >docs\python\pr ogram.
      >When I run the program for the interpreter, just as a .py, everything
      >works
      >just as it should. However, when I compile the main source as an .exe,
      >and
      >say let a friend try the program. It fails because it is missing the
      >.ico.
      >The catch, is I don't want to have it have to installed, at least at this
      >point, I want it to be able to just run. So how can I make it just run
      >from
      >any computer with the files not being in the immediate directory. If that
      >is
      >not possible, how can I put them in the immediate directory and still
      >make
      >it work. Because that directory may change a lot so the path will change..
      >>
      >Just a few questions. I hope someone out there can help me out!
      >--
      >View this message in
      >context:http://www.nabble.com/py2exe-issues-...cons-tp1849390...
      >Sent from the Python - python-list mailing list archive at Nabble.com.

      Put the part of the code that needs the ico file(s) into a try/except
      block. You could also try reading the py2exe wiki and tutorials. This
      one looks like it has relevant data:



      Mike
      --

      Well, that may solve the icon problem. But what about getting pictures in
      there?

      --
      View this message in context: http://www.nabble.com/py2exe-issues-...p18495626.html
      Sent from the Python - python-list mailing list archive at Nabble.com.

      Comment

      • Alexnb

        #4
        Re: py2exe issues with pictures and icons




        Alexnb wrote:



        Mike Driscoll wrote:
        >
        >On Jul 16, 1:37 pm, Alexnb <alexnbr...@gma il.comwrote:
        >>Hello
        >>>
        >>I am sure most of you are familiar with py2exe. I am having a bit of a
        >>problem. See the program has a few pictures involved and the .ico it
        >>uses
        >>for the windows. However, the pictures are stored in the same directory
        >>as
        >>the source, something like: C:\Docs and settings\me\My
        >>docs\python\p rogram.
        >>When I run the program for the interpreter, just as a .py, everything
        >>works
        >>just as it should. However, when I compile the main source as an .exe,
        >>and
        >>say let a friend try the program. It fails because it is missing the
        >>.ico.
        >>The catch, is I don't want to have it have to installed, at least at
        >>this
        >>point, I want it to be able to just run. So how can I make it just run
        >>from
        >>any computer with the files not being in the immediate directory. If
        >>that is
        >>not possible, how can I put them in the immediate directory and still
        >>make
        >>it work. Because that directory may change a lot so the path will
        >>change.
        >>>
        >>Just a few questions. I hope someone out there can help me out!
        >>--
        >>View this message in
        >>context:http://www.nabble.com/py2exe-issues-...cons-tp1849390...
        >>Sent from the Python - python-list mailing list archive at Nabble.com.
        >
        >
        >Put the part of the code that needs the ico file(s) into a try/except
        >block. You could also try reading the py2exe wiki and tutorials. This
        >one looks like it has relevant data:
        >
        >http://www.py2exe.org/index.cgi/CustomIcons
        >
        >Mike
        >--
        >http://mail.python.org/mailman/listinfo/python-list
        >
        >
        Well, that may solve the icon problem. But what about getting pictures in
        there?
        Okay, the icon fix didn't really fix it, what it did was make the .exe have
        the icon as the little picture for the shortcut, but it isn't really a
        shortcut. Whatever. But, I went and ran it on another computer and this was
        the error log it created right off the bat.

        Traceback (most recent call last):
        File "The GUI.py", line 696, in <module>
        File "Tkinter.py c", line 1515, in wm_iconbitmap
        _tkinter.TclErr or: bitmap "C:\Documen ts and Settings\Alex\M y
        Documents\PYTHO N\DictionaryApp \Windows.ico" not defined

        --
        View this message in context: http://www.nabble.com/py2exe-issues-...p18495836.html
        Sent from the Python - python-list mailing list archive at Nabble.com.

        Comment

        • Mike Driscoll

          #5
          Re: py2exe issues with pictures and icons

          On Jul 16, 3:22 pm, Alexnb <alexnbr...@gma il.comwrote:
          Alexnb wrote:
          >
          Mike Driscoll wrote:
          >
          On Jul 16, 1:37 pm, Alexnb <alexnbr...@gma il.comwrote:
          >Hello
          >
          >I am sure most of you are familiar with py2exe. I am having a bit of a
          >problem. See the program has a few pictures involved and the .ico it
          >uses
          >for the windows. However, the pictures are stored in the same directory
          >as
          >the source, something like: C:\Docs and settings\me\My
          >docs\python\pr ogram.
          >When I run the program for the interpreter, just as a .py, everything
          >works
          >just as it should. However, when I compile the main source as an .exe,
          >and
          >say let a friend try the program. It fails because it is missing the
          >.ico.
          >The catch, is I don't want to have it have to installed, at least at
          >this
          >point, I want it to be able to just run. So how can I make it just run
          >from
          >any computer with the files not being in the immediate directory. If
          >that is
          >not possible, how can I put them in the immediate directory and still
          >make
          >it work. Because that directory may change a lot so the path will
          >change.
          >
          >Just a few questions. I hope someone out there can help me out!
          >--
          >View this message in
          >context:http://www.nabble.com/py2exe-issues-...cons-tp1849390...
          >Sent from the Python - python-list mailing list archive at Nabble.com..
          >
          Put the part of the code that needs the ico file(s) into a try/except
          block. You could also try reading the py2exe wiki and tutorials. This
          one looks like it has relevant data:
          >>>
          Well, that may solve the icon problem. But what about getting pictures in
          there?
          >
          Okay, the icon fix didn't really fix it, what it did was make the .exe have
          the icon as the little picture for the shortcut, but it isn't really a
          shortcut. Whatever. But, I went and ran it on another computer and this was
          the error log it created right off the bat.
          >
          Traceback (most recent call last):
            File "The GUI.py", line 696, in <module>
            File "Tkinter.py c", line 1515, in wm_iconbitmap
          _tkinter.TclErr or: bitmap "C:\Documen ts and Settings\Alex\M y
          Documents\PYTHO N\DictionaryApp \Windows.ico" not defined
          >
          --
          View this message in context:http://www.nabble.com/py2exe-issues-...cons-tp1849390...
          Sent from the Python - python-list mailing list archive at Nabble.com.
          Crumb! I actually use a GUI wrapper for py2exe called GUI2Exe which
          makes this sort of thing much easier. Unfortunately, it also makes me
          less knowledgeable. You can check it out here:



          Also, there's a distutils group and a py2exe group. Both of them would
          know a lot more about how to do this.

          A distutils extension to create standalone windows programs from python scripts.



          Mike

          Comment

          • Larry Bates

            #6
            Re: py2exe issues with pictures and icons

            Alexnb wrote:
            Hello
            >
            I am sure most of you are familiar with py2exe. I am having a bit of a
            problem. See the program has a few pictures involved and the .ico it uses
            for the windows. However, the pictures are stored in the same directory as
            the source, something like: C:\Docs and settings\me\My docs\python\pro gram.
            When I run the program for the interpreter, just as a .py, everything works
            just as it should. However, when I compile the main source as an .exe, and
            say let a friend try the program. It fails because it is missing the .ico.
            The catch, is I don't want to have it have to installed, at least at this
            point, I want it to be able to just run. So how can I make it just run from
            any computer with the files not being in the immediate directory. If that is
            not possible, how can I put them in the immediate directory and still make
            it work. Because that directory may change a lot so the path will change.
            >
            Just a few questions. I hope someone out there can help me out!
            Windows can't read minds. The icon's/pictures have to either be in the same
            directory as the .exe or the .exe has to have a way to find them in another
            folder (e.g. via .ini config file).

            Takw a few minutes and go to: http://jrsoftware.org/isinfo.php

            It is a free Windows installer that I use to take py2exe, icons, pictures,
            ..ini files, documentation, etc and wrap it all up into a nice, neat package that
            can be distributed as a single .exe. It will take a couple of hours, but it
            will be hours well spent (especially if you think you will do this more than once).

            Larry

            Comment

            Working...