Skip to content
Andrej Vodopivec edited this page Jun 4, 2015 · 2 revisions

Message box

A message-box function displays an info dialog. It returns the button clicked as a string.

(message-box message &key title icon default detail parent type)

  • message the message displayed in the dialog
  • title the title of the dialog window
  • icon the icon displayed in the window; can be "error", "info", "question" or "warning"
  • detail the detailed message in the dialog
  • parent the parent window
  • type the type of the message; can be "abortretryignore", "ok", "okcancel", "retrycancel", "yesno" or "yesnocancel"

Tcl/Tk documentation for message-box.

File dialog functions

(get-open-file &key title parent initialdir filetypes)

(get-save-file &key title parent initialdir initialfile filetypes confirmowerwrite)

  • filetypes are specified as '(("Text files" "*.txt") ("All files" "*.*"))
  • initialdir and initialfile should be strings
  • if no file is selected (the dialog is canceled), and empty string is returned

Tcl/Tk documentation for get-open-file.

Tcl/Tk documentation for get-save-file.

Custom dialogs

To write custom dialogs (modal windows) use window-transient, grab-set and window-wait functions. An example is included in the examples subdirectory.

Clone this wiki locally