Keeyai.com

Zomg!

Sprial - A fractal flame by Keeyai

DirTreeCtrl

DirTreeCtrl — wxPython widget for displaying directories

As I was writing Flame (a GUI for Wix) I really wanted to show the contents of a directory in a tree, JUST like the GenericDirCtrl in wxPython. I tried using the GenericDirCtrl initially, but you really can’t customize it at all, most importantly you cannot set the directory you want to use - it always shows everything from the base drives out. I need this tree control for selecting files that go into an installer, so showing files outside of the relevant directory will be annoying for the experienced users and disastrous for the inexperienced. After a LOT of looking and hacking I didn’t find or create a working solution to the problem, so I started over and wrote the DirTreeCtrl below. It is simply a wx.TreeCtrl with some extra functionality related to the filesystem. When you pass the tree a directory, it gets the directory contents and displays them, querying the OS to get any file extension icons available. The file structure is loaded virtually to minimize memory usage and there is an option in the widget to remove loaded directory data if memory use is critical for you. More features below:

Features:

* Automatically loads files in the given directory
* File lists loaded on the fly when nodes are expanded so you only load what you need
* Gets the OS icons used for files when it can to emulate file explorer as much as possible
* Easily use your own icons for any file extension
* Automatically loads the correct icon if file shown is a .ico file
* Does NOT require win32 libraries or anything else outside of normal wxPython install

Download:
DirTreeCtrl - wxPython widget for displaying directories

No Comments

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.