.. include:: headings.inc .. _DirDialog: ========================================================================================================================================== |phoenix_title| **DirDialog** ========================================================================================================================================== This class represents the directory chooser dialog. .. _DirDialog-styles: |styles| Window Styles ================================ This class supports the following styles: - ``DD_DEFAULT_STYLE``: Equivalent to a combination of ``DEFAULT_DIALOG_STYLE`` and ``RESIZE_BORDER`` (the last one is not used under WinCE). - ``DD_DIR_MUST_EXIST``: The dialog will allow the user to choose only an existing folder. When this style is not given, a "Create new directory" button is added to the dialog (on Windows) or some other way is provided to the user to type the name of a new folder. - ``DD_CHANGE_DIR``: Change the current working directory to the directory chosen by the user. Notice that ``RESIZE_BORDER`` has special side effect under recent (i.e. later than Win9x) Windows where two different directory selection dialogs are available and this style also implicitly selects the new version as the old one always has fixed size. As the new version is almost always preferable, it is recommended that ``RESIZE_BORDER`` style be always used. This is the case if the dialog is created with the default style value but if you need to use any additional styles you should still specify ``DD_DEFAULT_STYLE`` unless you explicitly need to use the old dialog version under Windows. E.g. do :: dlg = wx.DirDialog (None, "Choose input directory", "", wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST) instead of just using ``DD_DIR_MUST_EXIST`` style alone. .. seealso:: :ref:`DirDialog Overview `, :ref:`FileDialog` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **DirDialog** .. raw:: html

Inheritance diagram of DirDialog

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~DirDialog.__init__` Constructor. :meth:`~DirDialog.GetMessage` Returns the message that will be displayed on the dialog. :meth:`~DirDialog.GetPath` Returns the default or user-selected path. :meth:`~DirDialog.SetMessage` Sets the message that will be displayed on the dialog. :meth:`~DirDialog.SetPath` Sets the default path. :meth:`~DirDialog.ShowModal` Shows the dialog, returning ``ID_OK`` if the user pressed ``OK``, and ``ID_CANCEL`` otherwise. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~DirDialog.Message` See :meth:`~DirDialog.GetMessage` and :meth:`~DirDialog.SetMessage` :attr:`~DirDialog.Path` See :meth:`~DirDialog.GetPath` and :meth:`~DirDialog.SetPath` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: DirDialog(Dialog) This class represents the directory chooser dialog. **Possible constructors**:: DirDialog(parent, message=DirSelectorPromptStr, defaultPath='', style=DD_DEFAULT_STYLE, pos=DefaultPosition, size=DefaultSize, name=DirDialogNameStr) .. method:: __init__(self, parent, message=DirSelectorPromptStr, defaultPath='', style=DD_DEFAULT_STYLE, pos=DefaultPosition, size=DefaultSize, name=DirDialogNameStr) Constructor. Use :meth:`ShowModal` to show the dialog. :param `parent`: Parent window. :type `parent`: Window :param `message`: Message to show on the dialog. :type `message`: string :param `defaultPath`: The default path, or the empty string. :type `defaultPath`: string :param `style`: The dialog style. See :ref:`DirDialog` :type `style`: long :param `pos`: Dialog position. Ignored under Windows. :type `pos`: Point :param `size`: Dialog size. Ignored under Windows. :type `size`: Size :param `name`: The dialog name, not used. :type `name`: string .. method:: GetMessage(self) Returns the message that will be displayed on the dialog. :rtype: `string` .. method:: GetPath(self) Returns the default or user-selected path. :rtype: `string` .. method:: SetMessage(self, message) Sets the message that will be displayed on the dialog. :param `message`: :type `message`: string .. method:: SetPath(self, path) Sets the default path. :param `path`: :type `path`: string .. method:: ShowModal(self) Shows the dialog, returning ``ID_OK`` if the user pressed ``OK``, and ``ID_CANCEL`` otherwise. :rtype: `int` .. attribute:: Message See :meth:`~DirDialog.GetMessage` and :meth:`~DirDialog.SetMessage` .. attribute:: Path See :meth:`~DirDialog.GetPath` and :meth:`~DirDialog.SetPath`