Interface compatible with PromptInterface for doing non-ncurses interaction.

By convention, the last line of a text parameter should be a short value with a trailing colon so that we can prompt a user for a value immediately after it.


wizard.prompt.make(prompt, non_interactive)

Makes a dialog.Dialog compatible class based on configuration.


class wizard.prompt.PromptInterface
infobox(text, **kwargs)

Gives the user a non-blocking message; useful if you are about to do an operation that will take some time.

inputbox(text, init='', **kwargs)

Request a free-form, single line of text from the user. Prompt the user using text; and init is the initial value filling the field; not all implementations support editing init. Returns the typed string.

menu(text, choices=[], **kwargs)

Request a selection from a number of choices from the user. Prompt the user using text; choices is a list of tuples of form (value to return, description), where value to return is the value that this function will return.

msgbox(text, **kwargs)

Gives the user a message that they must dismiss before proceeding.

passwordbox(text, **kwargs)

Securely requests a password from the user. Prompts the user using text; return value is the password.


class wizard.prompt.Dialog

Bases: wizard.prompt.PromptInterface

Ncurses interface using dialog.

class wizard.prompt.Prompt

Bases: wizard.prompt.PromptInterface

Simple stdin/stdout prompt object.

class wizard.prompt.FailPrompt

Bases: wizard.prompt.PromptInterface

Prompt that doesn’t actually ask the user; just fails with an error message.

Utility functions

wizard.prompt.fill(text, width=60, **kwargs)

Convenience wrapper for textwrap.fill() that preserves paragraphs.

wizard.prompt.guess_dimensions(text, width=60)

Guesses the dimensions that any given piece of text will need to display on terminal, given some width.


Joins a list of disjunctions into a human readable sentence.

>>> join_or(['foo'])
>>> join_or(['foo', 'bar', 'baz'])
'foo, bar or baz'

Convenience decorator that automatically:

  1. Removes already handled keyword arguments,
  2. Configures the dimensions of the dialog box, and
  3. Handles the different ext possibilities of dialog.

Convenience decorator that handles end-of-document and interrupts.


exception wizard.prompt.Error

Base error class.

exception wizard.prompt.MissingRequiredParam(cmdopt)

Bases: wizard.prompt.Error

Non-interactive, but we needed more info.

exception wizard.prompt.UserCancel

Bases: wizard.prompt.Error

User canceled the input process.

exception wizard.prompt.DialogError(exit)

Bases: wizard.prompt.Error

Dialog returned a mysterious error.

exception wizard.prompt.UnsupportedTerminal

Bases: wizard.prompt.Error

It doesn’t look like we support this terminal. Internal error.

Table Of Contents

Previous topic


Next topic


This Page