Commit 85dccf1e authored by Alon Swartz's avatar Alon Swartz

initial import of pythondialog_2.7

Peter Astrand <> (current maintainer)
Robb Shecter <>
Sultanbek Tezadov (
Florent Rougon <>
This diff is collapsed.
# The following lines are useful for debugging: they write the
# full command (with arguments quoted and environment
# variables set) to a file named "command.debug" in the
# current directory. See Dialog.__call_program() in
import commands
envvar_settings_list = []
if new_environ.has_key("DIALOGRC"):
"DIALOGRC='%s'" % new_environ["DIALOGRC"])
for var in _dialog_exit_status_vars.keys():
varname = "DIALOG_" + var
"%s=%s" % (varname, new_environ[varname]))
envvar_settings = string.join(envvar_settings_list, " ")
file("command.debug", "wb").write(
envvar_settings +
string.join(map(commands.mkarg, arglist), ""))
Python 2.2 or newer.
pythondialog is packaged with Distutils (the current standard way to
package Python extensions), so its installation should be as simple as:
- make this file's directory your shell's current directory
- optionally edit setup.cfg to make sure that it fits your needs
(particularly the installation prefix); in the case of the prefix,
you could alternatively specify it later with the --prefix,
--exec-prefix, etc. arguments of are described in
detail in the "Installing Python Modules" chapter of the Python
- a) 1) type:
python ./ build
2) then, as root:
python ./ install --record /path/to/foo
where foo is a file of your choice which will contain the list
of all files installed on your system by the preceding
command. This will make uninstallation easy (you could ommit
the "--record /path/to/foo", but uninstallation could not be
automated, then).
b) type, as root:
python ./ install --record /path/to/foo
This will automatically build the package before installing it.
The observations made in a) also apply here.
If this default installation is not what you wish, please read the
Distutils documentation. In Python 2.1 and above, it is included in the
base Python documentation and the chapter you'll need is most probably
"Installing Python Modules".
Provided you have followed the instructions given in the installation
section, you have a /path/to/foo file that contains all the files the
installation process put on your system. Great! All you have to do is:
while read file; do rm -f "$file"; done < /path/to/foo
under a Bourne-compatible shell and with the appropriate privileges
(maybe root, depending on where you installed pythondialog).
Note: this will handle file names with spaces correctly, unlike the
simpler "rm -f $(cat /path/to/foo)".
# global-exclude *~
Metadata-Version: 1.0
Name: pythondialog
Version: 2.7
Summary: A Python interface to the UNIX dialog utility and mostly-compatible programs
Author: Peter Astrand
License: LGPL
Description: A Python interface to the UNIX dialog utility, designed to provide
an easy, pythonic and as complete as possible way to use the dialog
features from Python code.
Back-end programs that are almost compatible with dialog are also
supported if someone cares about them.
Keywords: dialog,Xdialog,whiptail,text-mode interface
Platform: UNIX
pythondialog is a Python wrapper for the UNIX "dialog" utility written
by Savio Lam and modified by several people, whose home page you should
find at Its purpose is to
provide an easy to use, pythonic and as complete as possible interface
to dialog from Python code.
pythondialog is free software, licensed under the GNU LGPL.
If you want to get a quick idea of what this module allows you to do,
you should run
What is pythondialog good for? What are its limitations?
As you might infer from the name, dialog is a high-level program that
generates dialog boxes. So is pythondialog. They allow you to build nice
interfaces quickly and easily, but you don't have full control over the
widgets, nor can you create new widgets without modifying dialog itself.
If you need to do low-level stuff, you should have a look at ncurses or
slang instead.
pythondialog is fully documented through Python docstrings. Handy ways
to access to this documentation are to use the pydoc standalone program
or Python module.
You can type "pydoc dialog" at the command prompt in pythondialog base
directory. Alternatively, you can type:
- "import dialog; help(dialog)" at at a Python 2.2 command prompt (and
probably any later version)
To browse it in HTML format, you can launch an HTTP server listening on
port 1234 with "pydoc -p 1234 &" (yes, it is damn easy!) and simply
browse on http://localhost:1234/ afterwards.
Alternatively, you can dump the current documentation (as
found by Python if you did "import dialog") as an html file with
"pydoc -w dialog". This will generate dialog.html in the current
See the pydoc module's documentation for more information.
Using Xdialog instead of dialog
Starting with 2.06, there is an "Xdialog" compatibility mode that you
can use if you want pythondialog to run the graphical Xdialog program
(which *should* be found under instead of
dialog (text-mode, based on the ncurses library).
The primary supported platform is still dialog, but as long as only
small modifications are enough to make pythondialog work with Xdialog, I
am willing to support Xdialog if people are interested in it (which
turned out to be the case for Xdialog).
The from pythondialog 2.06 has been tested with Xdialog 2.0.6
and found to work well (barring Xdialog's annoying behaviour with the
file selection dialog box).
* pythondialog seems not to work very well with whiptail. Well, whiptail
is not very compatible with dialog any more. Although you can tell
pythondialog the program you want it to invoke, only programs that are
mostly dialog-compatible are supported.
* It is said that there is a bug in (at least) the Mandrake 7.0 Russian
Edition running on AMD K6-2 3D that causes core dump when `dialog' is run
with the --gauge option; in this case you'll have to recompile the `dialog'
pythondialog was originally written by Robb Shecter. Sultanbek Tezadov
added some features to it (mainly the first gauge implementation, I
guess). Florent Rougon rewrote most parts of the program to make it
more robust and flexible so that it can give access to most features
of the dialog program. Finally, I (Peter Astrand) took over
maintainership for both the original version and Florents updated
* Add code so that the input buffer is flushed before a dialog box is shown.
This would make the UI more predictable for users. This feature could be
turned on and off through an instance method.
-> Unclear to me (Florent).
* Try detecting the terminal window size in order to make reasonable height
and width defaults. Hmmm -- should also then check for terminal resizing...
This diff is collapsed.
This diff is collapsed.
#! /usr/bin/env python
# --- Setup script for pythondialog
# Copyright (c) 2002, 2003, 2004 Florent Rougon
# This file is part of pythondialog.
# pythondialog is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# pythondialog is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os, string, sys
from distutils.core import setup
# Note:
# The Distutils included in Python 2.1 don't understand the "license" keyword
# argument of setup correctly (they only understand licence); as I don't want
# to mispell it, if you run the Distutils from Python 2.1, you will get
# License: UNKNOWN. This problem does not appear with the version included in
# Python 2.2.
PACKAGE = "pythondialog"
VERSION = "2.7"
def main():
description="A Python interface to the UNIX dialog utility and "
"mostly-compatible programs",
# Doesn't work great with several authors...
author="Robb Shecter, Sultanbek Tezadov, Florent Rougon, Peter Astrand",
maintainer="Peter Astrand",
A Python interface to the UNIX dialog utility, designed to provide
an easy, pythonic and as complete as possible way to use the dialog
features from Python code.
Back-end programs that are almost compatible with dialog are also
supported if someone cares about them.""",
keywords=["dialog", "Xdialog", "whiptail", "text-mode interface"],
if __name__ == "__main__": main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment