I've created a exe from a Python file using PyInstaller and including an file icon. However it only shows when I have the folder option set to small icons (I'm using Windows 7).
Do I need to specify icons for when the folder option is set to display medium or large icons, and if so how?
The ico file I have at the moment is 128 x 128 px if that's important.
You need to build your ico file so that it embeds all sizes you wish to display.
Download a free icon that has all sizes to test with, like this one.
http://www.iconfinder.com/icondetails/17840/128/ark_arrow_box_download_dropbox_kde_package_icon
Then you can use the free program called icofx to edit your own ico file and generate the different sizes you need.
Good Luck! Let me know if this helps!
Related
This is what I do to assign an icon shown in 'Alt-Tab' list to my python script.
self.icon = tk.PhotoImage(file=iconpath)
self.root.tk.call('wm', 'iconphoto', self.root._w, self.icon)
But it only works with .gif, which can't handle antialiasing for transparency correctly.
The same .ico file I created my .gif from looks perfect when assigned to .bat file for example.
Is there a way to make the .py script look not so much worse than .bat script in alt-tab menu?
self.root.iconbitmap(iconpath)
solved the issue (it accepts .ico - under Windows at least)
How can I set an applications image (icon) in my canonical-quickly project? Even if I set the icon path in Glade, the UI designer, my icon doesn't show up.
In the aplications bar of my desktop I only see a gear.
I used the following relative path in Glade:
../media/projectname.svg
It's been a while but anyway...
You should put it here:
YOUR_QUICKLY_PROJECT_FOLDER/data/media/YOU_PROJECT_NAME.svg
(.png/.jpg might work also, I am not sure)
And you don't need to set it anywhere in the programme.
I wrote a little app with a gui to analyze xml files. I have 2 .py files where 1 is the GUI and the second handels the xml.
My Problem is that the Icons i set and also a gif that i show using QMovie are not showing up on any machine but my development machine.
The other machines do not have PyQt or Python installed. They are using my Installation-folder from Python that I've copied onto a network drive. The i just copied the python32.dll in the machines system32 folder and the app works...except for the icons.
That's how i set the icons and reference the gif:
self.setWindowIcon(QtGui.QIcon("grabb.ico"))
--------other code---------
self.movie = QMovie("load.gif", QByteArray(), self)
self.movie.setCacheMode(QMovie.CacheAll)
self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.movie.start()
The file is in the same dir as the py so this should work. I've also tried absolute paths but that didn't give me any better results.
Now i have read on stack that this could be resolved by using the ressource-system.
So i used the designer to create a ressource files and then compiled it using pyrcc4 into a .py (using the parameter for python 3). Now I'm reffering to the images like this:
self.setWindowIcon(QtGui.QIcon(":icon/grabber.ico"))
--------other code---------
self.movie = QMovie(":loader/load.gif", QByteArray(), self)
self.movie.setCacheMode(QMovie.CacheAll)
self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.movie.start()
This again works fine on my machine but nowhere else.
Any ideas as to why only ma machine shows the icons ?
I'm not using py2exe or alike!
I too came across the same situation.
One approach is to set the paths in qt.config file and place this in the location of your executable.
I tested this with Python 2.6, and its working fine without any issue.
You said that you have shared your python installation which has PyQt4 init.
Lets say you python share path is \\somesystem\Python26
Yo will find a qt.config file in \\somesystem\Python26\PyQt4. Take it and replace the below lines in qt.conf
[Paths]
Prefix = //somesystem/Python26/PyQt4
Binaries = //somesystem/Python26/PyQt4
Frustrated by lack of a simple ACDSee equivalent for OS X, I'm looking to hack one up for myself. I'm looking for a gui library that accommodates:
Full screen image display
High quality image fit-to-screen (for display)
Low memory usage
Fast display
Reasonable learning curve (the simpler the better)
Looks like there are several choices, so which is the best? Here are some I've run across:
PyOpenGL
PyGame
PyQT
wxpython
I don't have any particular experience with any of these, nor any strong desire to become an expert - I'm looking for the simplest solution.
What do you recommend?
[Update]
For those not familiar with ACDSee, here's what it does that I care about:
Simple list/thubmnail display of images in a directory
Sort by name/size/type
Ability to view images full screen
Single-key delete while viewing full screen
Move to next/previous image while viewing full screen
Ability to select a group of images for:
move to / copy to directory
delete
resize
ACDSee has a bunch of niceties as well, such as remembering directories you've moved images to in the past, remembering your resize settings, displaying the total size of the images you've selected, etc.
I've tried most of the options I could find (including Xee) and none of them quite get there. Please keep in mind that this is a programming/library question, not a criticism of any of the existing tools.
I will recommend using wxPython to create such a viewer, wxPython is easy to learn, free, cross platform and blends well in OSX. Even if you want to use pyopengl, wxPython would be good with pyopengl.
see such tutorials http://showmedo.com/videotutorials/video?name=1790000&fromSeriesID=179
and there is already cornice written in wxpython/PIL, may be you can modify that. It has been inspired by the famous Windows-only ACDSee :)
it's not an answer to your coding question but for (a big part of) the lack of ACDsee equivalent (requires OSX 10.5+):
Simple list/thubmnail display of images in a directory: Finder.app
Sort by name/size/type: Finder.app will do name & type, not image size (but does file size)
Ability to view images full screen: quick preview (spacebar / eye icon)
Single-key delete while viewing full screen: command-backspace while viewing in quickpreview, both windowed and fullscreen
Move to next/previous image while viewing full screen: both quickprewiew (after selecting a group of images or whole directory with cmd-a) and Preview.app
Ability to select a group of images for[...]: Finder.app will does all but resize
seems like you have everything except resize just pressing the spacebar while in finder.
Preview.app will resize both a single image or multiple ones in one batch.
Use an App like Picasa (now available on mac). Use AppleScript through Python to control it from your application.
Failing that, use PyObjC to create Cocoa image display component and dialogs, and so on.
I ended up using PyGame, has been pretty good so far.
How do I make icons for my exe file when compiling my Python program?
I was searching for this a while ago, and found this: http://www.mail-archive.com/pygame-users#seul.org/msg05619.html
Quote from above link:
The setup.py File: PY_PROG =
'trek10.py' APP_NAME = 'Trek_Game'
cfg = {
'name':APP_NAME,
'version':'1.0',
'description':'',
'author':'',
'author_email':'',
'url':'',
'py2exe.target':'',
'py2exe.icon':'icon.ico', #64x64
'py2exe.binary':APP_NAME, #leave off the .exe, it will be added
'py2app.target':'',
'py2app.icon':'icon.icns', #128x128
'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython',
'cx_freeze.target':'',
'cx_freeze.binary':APP_NAME,
}
--snip--
Linking the icons is answered in other answers. Creating the thing is as easy as using png2ico. It creates an ico file from 1 or more png's and handles multiple sizes etc, like:
png2ico myicon.ico logo16x16.png logo32x32.png
Will create myicon.ico with sizes 16x16 and 32x32. Sizes must be multiples of 8 squares, and no larger than 256x256.
py2exe is a little dated, and has been continued with pyinstaller (which itself is a little dated; the svn release is the most up to date)
http://pyinstaller.python-hosting.com/
After running through the initial scripts for pyinstaller and generating the spec file from Makespec.py, edit the spec file and look for the EXE section. At the tail end of that just add in your ico definition; so
console=True)
would become
console=True, icon='mine.ico' )
That is, if the mine.ico file were in the same folder as the Makespec.py file. There's also a command line option for feeding the icon into it. I think it was
python Makespec.py -i 'mine.ico' /path/to/file.py
I have no experience with py2exe but a quick google search found this, if embedding icons in exe files was what you asked for.
If you want to create .ico files, I'd really suggest you search for a icon designer or finished icons. Sure you can create a Win 3.x style icon fairly easy by creating a 16x16, 32x32, or 64x64 px image in paint, and rename it to .ico. But to create modern multi resolution icons for windows is a lot more complicated.
(I was about to ask what OS you was compiling for, when I realized "exe" sounds very windows, and sure enough...)