Home Software Hardware Misc About

DirListCtrl

vs. 0.1 (16/11/2021)

DirListCtrl

DirListCtrl is a wxPython ListCtrl-like widget optimized for directory lists.

It handles sorting when its column header is clicked on, it is a drop target which accepts files dragged from a file manager and can also have its contents programmatically added or removed.

Click here to download the code containing the DirListCtrl class.

Tested on wxPython 4.1.0 (gtk3) on Python 3.7.3 on Raspberry Pi OS and on wxPython 4.1.1 (gtk3) on Python 3.8.10 on Mint (Mate). DirListCtrl is distributed under the BSD-3-Clause License.


Methods

__init__(parent, label="Source Directories:", header="Directory", dirs=[], tool_size=wx.Size(32, 32), bmp_size=wx.Size(16, 16), style=wx.BORDER_DEFAULT)

label and header are the strings shown in the control; tool_size and bmp_size refer to the size of the control's Add and Remove buttons and their bitmaps; style is one of wx.Window's available border styles.

AddMany(list)

Adds a python list of directories to the control.

GetDirList()

Returns the directories shown in the control as a python list.

RemoveAll()

Removes all directories from the control.