Skip to main content

A Python interface to the UNIX dialog utility and mostly-compatible programs

Project description

Easy writing of graphical interfaces for terminal-based applications

Overview

pythondialog is a Python wrapper for the UNIX dialog utility originally written by Savio Lam and later rewritten by Thomas E. Dickey.

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 (GNU Lesser General Public License).

If you want to get a quick idea of what this module allows you to do, you should run demo.py:

python3 demo.py

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. For sophisticated text-mode interfaces, the Urwid Python library looks rather interesting, too.

Requirements

  • As of version 2.12, pythondialog requires Python 3.0 or later in the 3.x series. pythondialog 2.14.0 has been tested with Python 3.2 and 3.3.

  • I will probably provide a Python 2 backport at some point around release 2.15, but this will not be regular, and probably not of the same quality as the Python 3 version. In the meantime, users who really want to stick to Python 2 should use version 2.11 (which can be found from the home page, or directly from the SourceForge download page).

  • Apart from that, pythondialog requires the dialog program (or a drop-in replacement for dialog). You can download dialog from:

    http://invisible-island.net/dialog/dialog.html

Documentation

pythondialog is fully documented through Python docstrings. This documentation can be browsed with the pydoc3 standalone program or by simply opening dialog.py in a pager or editor. The documentation of the latest version as rendered by pydoc3 should be available at:

http://pythondialog.sourceforge.net/doc/pythondialog.html

To generate the documentation yourself from dialog.py, you can type “pydoc3 dialog” at the command prompt in the pythondialog base directory or “pydoc3 /path/to/dialog.py”. Alternatively, you can type:

>>> import dialog; help(dialog)

at a Python 3 command prompt.

You can extract the documentation from dialog.py to an HTML file with “pydoc3 -w dialog” or “pydoc3 -w /path/to/dialog.py”. This will generate dialog.html in the current directory.

Alternatively, if pythondialog is already installed, pydoc3 can act as an HTTP server and provide the documentation to web browsers. For instance, launching “pydoc3 -p 1234” will make it listen on TCP port 1234. You can then point your browser to http://localhost:1234/ and read the documentation.

See the pydoc module documentation for more information.

Using Xdialog instead of dialog

As far as I can tell, Xdialog has not been ported to GTK+ 2 or later. It is not in Debian stable nor unstable (June 23, 2013). It is not installed on my system (because of the GTK+ 1.2 dependency), and according to the Xdialog-specific patches I received from Peter Åstrand in 2004, was not a drop-in replacement for dialog (in particular, Xdialog seemed to want to talk to the caller through stdout instead of stderr, grrrrr!).

All this to say that, even though I didn’t remove the options to use another backend than dialog, nor did I remove the handful of little, non-invasive modifications that help pythondialog work better with Xdialog, I don’t really support the latter. I test everything with dialog, and nothing with Xdialog.

That being said, here is the old text of this section (from 2004), in case you are still interested:

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 http://xdialog.free.fr/) 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 demo.py 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).

Whiptail, anyone?

Well, pythondialog seems not to work very well with whiptail. The reason is that whiptail is not compatible with dialog anymore. Although you can tell pythondialog the program you want it to invoke, only programs that are mostly dialog-compatible are supported.

Troubleshooting

If you have a problem with a pythondialog call, you should read its documentation and the dialog(1) manual page. If this is not enough, you can enable logging of shell command-line equivalents of all dialog calls made by your program with a simple call to Dialog.setup_debug(), first available in pythondialog 2.12. An example of this can be found in demo.py.

As of version 2.12, you can also enable this debugging facility for demo.py by calling it with the –debug flag (cf. ‘demo.py –help’).

History

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. Peter Åstrand took over maintainership between 2004 and 2009, with particular care for the Xdialog support. Florent Rougon took over maintainership again starting from 2009…

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

pythondialog-2.14.0.tar.gz (73.4 kB view details)

Uploaded Source

pythondialog-2.14.0.tar.bz2 (59.4 kB view details)

Uploaded Source

pythondialog-2.11.tar.bz2 (43.1 kB view details)

Uploaded Source

File details

Details for the file pythondialog-2.14.0.tar.gz.

File metadata

  • Download URL: pythondialog-2.14.0.tar.gz
  • Upload date:
  • Size: 73.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pythondialog-2.14.0.tar.gz
Algorithm Hash digest
SHA256 474a35a0c12cbb3ac27da37019e55a5c9d089825241f94ba9655e047406a3407
MD5 b11fa8411b979da35fee9a6361ded329
BLAKE2b-256 f4d7fd8decc0157ada8634bd1532cc9d810d996c88248c38e8a96bd0eaf3ed1f

See more details on using hashes here.

File details

Details for the file pythondialog-2.14.0.tar.bz2.

File metadata

File hashes

Hashes for pythondialog-2.14.0.tar.bz2
Algorithm Hash digest
SHA256 9a04b182dbf8b428bcf76a066a8e08fe5ab61dd779a3f246d918ce2010f799ff
MD5 528db548b33a125ee58040d8490e722a
BLAKE2b-256 fd9623372ac6b159aaf2e453019945892c2e3c92dfe1bf558ae5665bcca6813f

See more details on using hashes here.

File details

Details for the file pythondialog-2.11.tar.bz2.

File metadata

  • Download URL: pythondialog-2.11.tar.bz2
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pythondialog-2.11.tar.bz2
Algorithm Hash digest
SHA256 5867cc9156e28aa3d2f37bfe2f26f64354c073048c0b67973f49dc6fb6d842d3
MD5 46d1856b1a0935de23e9de8dcc8e547d
BLAKE2b-256 767bc0c63511c331a46d2942dee82e5de8ee5bd501961b7b9a2441497c459f4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page