wx.GenericDirCtrl

Inheritance diagram for wx.GenericDirCtrl:



Description

This control can be used to place a directory listing (with optional files) on an arbitrary window.

The control contains a wx.TreeCtrl window representing the directory hierarchy, and optionally, a wx.Choice window containing a list of filters.

Window Styles

Window Style Description
wx.DIRCTRL_DIR_ONLY Only show directories, and not files.
wx.DIRCTRL_3D_INTERNAL Use 3D borders for internal controls.
wx.DIRCTRL_SELECT_FIRST When setting the default path, select the first file in the directory.
wx.DIRCTRL_SHOW_FILTERS Show the drop-down filter list.
wx.DIRCTRL_EDIT_LABELS Allow the folder and file labels to be editable.

Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


Class API

Methods

__init__(parent, id=-1, dir=wx.DirDialogDefaultFolderStr, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DIRCTRL_3D_INTERNAL|wx.SUNKEN_BORDER, filter="", defaultFilter=0, name=wx.TreeCtrlNameStr)

Constructor.

Parameters:

  • parent (wx.Window)
  • id (int)
  • dir (string)
  • pos (wx.Point)
  • size (wx.Size)
  • style (long)
  • filter (string)
  • defaultFilter (int)
  • name (string)

Returns:

wx.GenericDirCtrl


CollapsePath(path)

Collapse the given path.

Parameters:

  • path (string)

Returns:

bool


DoResize()
No docstrings available for this method.

ExpandPath(path)

Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control.

Parameters:

  • path (string)

Returns:

bool


FindChild(parentId, path)

Find the child that matches the first part of path. E.g. if a child path is “/usr” and path is “/usr/include” then the child for “/usr” is returned.

If the path string has been used (we’re at the leaf), done is set to True.

Parameters:


Returns:

(item, done)


GetDefaultPath()

Gets the default path.


Returns:

string


GetDirItemData(id)

Parameters:


Returns:

wx.DirItemData


GetFilePath()

Gets selected filename path only (else empty string).

This function doesn’t count a directory as a selection.


Returns:

string


GetFilter()

Returns the filter string.


Returns:

string


GetFilterIndex()

Returns the current filter index (zero-based).


Returns:

int


GetFilterListCtrl()

Returns a pointer to the filter list control (if present).


Returns:

wx.DirFilterListCtrl


GetPath()

Gets the currently-selected directory or filename.


Returns:

string


GetRootId()

Returns the root id for the tree control.


Returns:

wx.TreeItemId


GetShowHidden()
No docstrings available for this method.

GetTreeCtrl()

Returns a pointer to the tree control.


Returns:

wx.TreeCtrl


ReCreateTree()
Collapse and expand the tree, thus re-creating it from scratch. May be used to update the displayed directory content.

SetDefaultPath(path)

Sets the default path.

Parameters:

  • path (string)

SetFilter(filter)

Sets the filter string.

Parameters:

  • filter (string)

SetFilterIndex(n)

Sets the current filter index (zero-based).

Parameters:

  • n (int)

SetPath(path)

Sets the current path.

Parameters:

  • path (string)

ShowHidden(show=True)

Parameters:

  • show (bool)

Properties

DefaultPath
See GetDefaultPath and SetDefaultPath
FilePath
See GetFilePath
Filter
See GetFilter and SetFilter
FilterIndex
See GetFilterIndex and SetFilterIndex
FilterListCtrl
See GetFilterListCtrl
Path
See GetPath and SetPath
RootId
See GetRootId
TreeCtrl
See GetTreeCtrl