Welcome to wdlg’s documentation!

wdlg package

wdlg.filedialog module

for creating file/directory dialogs.

This module provides functions for creating file/directory selection dialogs.

wdlg.filedialog.askdirectory(hwnd: Optional[ctypes.c_void_p] = None, initialdir: Optional[str] = None) str

Ask for a directory, and return the path.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • initialdir – The initial directory.

Returns

The directory path or None if cancel button selected.

wdlg.filedialog.askopenfilename(hwnd: Optional[ctypes.c_void_p] = None, initialdir: Optional[str] = None, initialfile: Optional[str] = None, filetypes: Optional[List[Tuple[str, str]]] = None) str

Ask for a file to open, and return the path.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • initialdir – The directory that the dialog starts in.

  • initialfile – The file name used to initialize the File Name edit control.

  • filetypes – The file types that the dialog can open.

Returns

The file path or None if cancel button selected.

wdlg.filedialog.askopenfilenames(hwnd: Optional[ctypes.c_void_p] = None, initialdir: Optional[str] = None, initialfile: Optional[str] = None, filetypes: Optional[List[Tuple[str, str]]] = None) List[str]

Ask for multiple files to open, and return the list of paths.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • initialdir – The directory that the dialog starts in.

  • initialfile – The file name used to initialize the File Name edit control.

  • filetypes – The file types that the dialog can open.

Returns

The list of file paths or None if cancel button selected.

wdlg.filedialog.asksaveasfilename(hwnd: Optional[ctypes.c_void_p] = None, initialdir: Optional[str] = None, initialfile: Optional[str] = None, filetypes: Optional[List[Tuple[str, str]]] = None) str

Ask for a file to save as, and return the path.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • initialdir – The directory that the dialog starts in.

  • initialfile – The file name used to initialize the File Name edit control.

  • filetypes – The file types that the dialog can save.

Returns

The file path or None if cancel button selected.

wdlg.messagebox module

for creating the message boxes.

this module provides functions for creating message boxes.

wdlg.messagebox.askokcancel(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) bool

Ask if operation should proceed, return true if the answer is ok.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Returns

Return true, if the answer is ok.

wdlg.messagebox.askquestion(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) bool

Ask a question, return true if the answer is yes.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Returns

Return true, if the answer is yes.

wdlg.messagebox.askretrycancel(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) bool

Ask if operation should be retried, return true if the answer is yes.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Returns

Return true, if the answer is yes.

wdlg.messagebox.askyesno(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) bool

Ask a question, return true if the answer is yes.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Returns

Return true, if the answer is yes.

wdlg.messagebox.askyesnocancel(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) bool

Ask a question, return true if the answer is yes, return None if cancelled.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Returns

Return true if the answer is yes. Return false if the answer is no. Return None if the answer is cancel.

wdlg.messagebox.showerror(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) None

Show a error messsage.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

wdlg.messagebox.showinfo(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) None

Show an info message.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

wdlg.messagebox.showwarning(hwnd: Optional[ctypes.c_void_p] = None, title: Optional[str] = None, main_msg: Optional[str] = None, message: Optional[str] = None) None

Show a warning message.

Parameters
  • hwnd – A handle to the window that owns the dialog box.

  • title – A string to be used for window title.

  • main_msg – A string to be used for the main instruction.

  • message – A string used for additional text.

Module contents

dialog library for windows