Welcome to Dialite’s documentation!

Dialite is a small library to show simple dialogs to the user, without the need for a heavy GUI toolkit.

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.

Dependencies and installation

Dialite is pure Python and has no dependencies. It works on Python 2.7 and 3.4+. Install using: pip install dialite.

Reference

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.
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.
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.
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:

bool

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:

bool

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:

bool

Indices and tables