Reference for flexx.dialite

Dialite introduction

Dialite is a pure Python package to show dialogs. It is lightweight, cross-platform, and has no dependencies. It provides a handful of functions, each a verb, that can be used to inform(), warn() or fail() the user, or to ask_ok(), ask_retry() or ask_yesno().

Dialite can show dialogs on Window, OS X and Linux, and falls back to a terminal interface if dialogs are unavailable (e.g. if not supported by the platform, or for SSH connections).

On Windows, it uses Windows Script Host (cscript.exe). On OS X it uses osascript to show a dialog from the frontmost application. On Linux it uses Zenity.

Dialite API

flexx.dialite.inform(title='Info', message='')

Inform the user about something.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
flexx.dialite.warn(title='Warning', message='')

Warn the user about something.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
flexx.dialite.fail(title='Error', message='')

Show a message to let the user know that something failed.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
flexx.dialite.ask_ok(title='Confirm', message='')

Ask the user to confirm something via an ok-cancel question.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
Returns:

Whether the user selected “OK”.

Return type:

result (bool)

flexx.dialite.ask_retry(title='Retry', message='')

Ask the user whether to retry something via a retry-cancel question.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
Returns:

Whether the user selected “Retry”.

Return type:

result (bool)

flexx.dialite.ask_yesno(title='Question', message='')

Ask the user a yes-no question.

Parameters:
  • title (str) – the text to show as the window title.
  • message (str) – the message to show in the body of the dialog.
Returns:

Whether the user selected “Yes”.

Return type:

result (bool)