Native-looking folder icons in `wx.TreeCtrl`

Hey,

I’m making a wx.TreeCtrl with folders in it and I want native-looking folder icons for it. (Need two icons, one for a closed folder and one for an open folder.)

In the TreeCtrl demo I saw that wxPython offers folder icons, but they don’t look native: They’re blue instead of yellow (for XP) and they have an arrow in them which XP’s folder icon don’t have. (I want the folders to look native on all platforms, not just XP.)

Is there a more native option?

Thanks,

Ram.

For windows you can use wx.IconLocation to reference the icons in c:\windows\system32\shell32.dll and then extract with wx.IconFromLocation. For Linux the icons you get from wx.ArtProvider should be the same ones used by the active Theme.

···

On 5/10/11 3:24 PM, cool-RR wrote:

Hey,

I'm making a `wx.TreeCtrl` with folders in it and I want native-looking
folder icons for it. (Need two icons, one for a closed folder and one
for an open folder.)

In the `TreeCtrl` demo I saw that wxPython offers folder icons, but they
don't look native: They're blue instead of yellow (for XP) and they have
an arrow in them which XP's folder icon don't have. (I want the folders
to look native on all platforms, not just XP.)

Is there a more native option?

--
Robin Dunn
Software Craftsman

Trying to load the file c:\windows\system32\shell32.dll by path sounds like a bad idea. What if the user has Windows installed on a different drive or in a non-standard path? Is there a better solution?

Also, any clue what I do for Mac?

If it’s feasible I could make a little abstraction that would get the correct folder icon in a cross-platform way.

Ram.

Ah, I see now:

https://groups.google.com/d/topic/wxpython-users/LfZLy0Torts/discussion

This might work.

HI,

Trying to load the file `c:\windows\system32\shell32.dll` by path sounds
like a bad idea. What if the user has Windows installed on a different drive
or in a non-standard path? Is there a better solution?
Also, any clue what I do for Mac?

I wrote a patch to wxWidgets some (wow 4 years ago already) years ago
to add more native icons to the ArtProvider which was unfortunatly
never merged or any comment on alternate implementation given. The
current ArtProvider on wxMac only has the native Error/Info/Warning
icons.

http://trac.wxwidgets.org/ticket/8778

Will need to do the footwork yourself but may be able to see how to
get the icons from the Carbon/Cocoa api from that patch.

Cody

···

On Sat, May 14, 2011 at 3:36 PM, cool-RR <ram.rachum@gmail.com> wrote:

Thanks Cody. This solution is lost on me since I don’t know C at all, but I hope it gets merged to wxPython. (Assuming it works well.)

Ram.

···

On Sat, May 14, 2011 at 4:44 PM, Cody Precord codyprecord@gmail.com wrote:

HI,

On Sat, May 14, 2011 at 3:36 PM, cool-RR ram.rachum@gmail.com wrote:

Trying to load the file c:\windows\system32\shell32.dll by path sounds

like a bad idea. What if the user has Windows installed on a different drive

or in a non-standard path? Is there a better solution?

Also, any clue what I do for Mac?

I wrote a patch to wxWidgets some (wow 4 years ago already) years ago

to add more native icons to the ArtProvider which was unfortunatly

never merged or any comment on alternate implementation given. The

current ArtProvider on wxMac only has the native Error/Info/Warning

icons.

http://trac.wxwidgets.org/ticket/8778

Will need to do the footwork yourself but may be able to see how to

get the icons from the Carbon/Cocoa api from that patch.

Cody

Hi Cody,

HI,

Trying to load the file `c:\windows\system32\shell32.dll` by path sounds
like a bad idea. What if the user has Windows installed on a different drive
or in a non-standard path? Is there a better solution?
Also, any clue what I do for Mac?

I wrote a patch to wxWidgets some (wow 4 years ago already) years ago
to add more native icons to the ArtProvider which was unfortunatly
never merged or any comment on alternate implementation given. The
current ArtProvider on wxMac only has the native Error/Info/Warning
icons.

wxTrac has been migrated to GitHub Issues - wxWidgets

Will need to do the footwork yourself but may be able to see how to
get the icons from the Carbon/Cocoa api from that patch.

BTW, speaking of unlanded features, if you're interested, I've recently set up a git repo that mirrors wxWidgets, wxPython, and Phoenix, and if you want, you could throw your changes on a branch. The URL is:

https://www.gitorious.org/wxpython_trunk_mirror

I've seen so many patches / features get put in limbo, or have so many additional YAGNI requirements and changes tacked on before it would be approved to land that even getting simple stuff in becomes a major project. So with git branches it's easy to have the code somewhere that at least those that want it can use it, and maybe if we get some good patches in there, Robin might even be tempted to build off the git repo to get all the extra goodies. :wink: Especially something like this patch, which is a clear no-brainer to add in.

Anyway, just let me know if you want write access to the repo.

Thanks,

Kevin

···

On May 14, 2011, at 1:44 PM, Cody Precord wrote:

On Sat, May 14, 2011 at 3:36 PM, cool-RR <ram.rachum@gmail.com> wrote:

Cody

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en