Package: pythondialog
Easy writing of graphical interfaces for terminal-based applicationsOverviewpythondialog is a Python wrapper for the UNIXdialogutility
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 todialogfrom Python code.pythondialog is free software, licensed under the GNU LGPL (GNU Lesser
General Public License). Its home page is located at:https://pythondialog.sourceforge.io/and contains ashort example,screenshots, asummary of the recent
changes, links to thedocumentation, theGit repository, themailing list, theissue tracker, etc.If you want to get a quick idea of what this module allows one to do,
you can download a release tarball and rundemo.py:PYTHONPATH=. python3 examples/demo.pyWhat 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 atncurses(cf. thecursesmodule in the Python standard library),blessingsor slang instead. For sophisticated text-mode interfaces, theUrwid
Python librarylooks rather interesting, too.RequirementsAs of version 2.12, pythondialog requires Python 3.0 or later in the 3.x
series. pythondialog 3.5.3 has been tested with Python 3.9.dialogversion 1.3-20201126-1 (the version shipped in Debian stable
and unstable in November 2021) isbroken; don’t waste your time with that
version.dialog1.3-20210621 works fine.Versions of pythondialog up to and including 3.5.1 had a backport to
Python 2, however this outdated Python dialect isn’t supported
anymore. You may find pointers to the old packages with Python 2
support on thepythondialog home page.Apart from that, pythondialog requires thedialogprogram (or a
drop-in replacement for dialog). You can download dialog from:https://invisible-island.net/dialog/dialog.htmlNote that some features of pythondialog may require recent versions of
dialog.Quick installation instructionsIf you have a workingpipsetup,
you should be able to install pythondialog with:pip install pythondialogWhen doing so, make sure that yourpipexecutable runs with the
Python 3 installation you want to install pythondialog for.For more detailed instructions, you can read theINSTALLfile from a
release tarball. You may also want to consult thepip documentation.DocumentationThe pythondialog ManualThe pythondialog Manual is written inreStructuredTextformat for theSphinxdocumentation generator. The HTML documentation for the latest
version of pythondialog as rendered by Sphinx should be available at:https://pythondialog.sourceforge.io/doc/The sources for the pythondialog Manual are located in thedoctop-level directory of the pythondialog distribution, but the
documentation build process pulls many parts fromdialog.py(mainly
docstrings).To generate the documentation yourself fromdialog.pyand the
sources in thedocdirectory, first make sure you haveSphinxandMakeinstalled. Then, you can go to thedocdirectory and type,
for instance:make htmlYou will then find the output in the_build/htmlsubdirectory ofdoc.Sphinxcan build the documentation in many other formats.
For instance, if you haveLaTeXinstalled, you can generate the
pythondialog Manual in PDF format using:make latexpdfYou can runmakefrom thedocdirectory to see a list of the
available formats. Runmake cleanto clean up after the
documentation build process.For those who have installedSphinxbut notMake, it is still
possible to build the documentation with a command such as:sphinx-build -b html . _build/htmlrun from thedocdirectory. Please refer tosphinx-buildfor more
details.Reading the docstrings from an interactive Python interpreterIf you have already installed pythondialog, you may consult its
docstrings in an interactive Python interpreter this way:>>> import dialog; help(dialog)but only parts of the documentation are available using this method, and
the result is much less convenient to use than thepythondialog
Manualas generated bySphinx.Enabling Deprecation WarningsThere are a few places indialog.pythat send aDeprecationWarningto warn developers about obsolete features.
However, because of:the dialog output to the terminal;the fact that such warnings are silenced by default since Python 2.7
and 3.2;you have to do two things in order to see them:redirect the standard error stream to a file;enable the warnings for the Python interpreter.For instance, to see the warnings produced when running the demo, you
can do:PYTHONPATH=. python3 -Wd examples/demo.py 2>/path/to/fileand examine/path/to/file. This can also help you to find files that
are still open when your program exits.Note:If your program is terminated by an unhandled exception while stderr
is redirected as in the preceding command, you won’t see the traceback
until you examine the file stderr was redirected to. This can be
disturbing, as your program may exit with no apparent reason in such
conditions.For more explanations and other methods to enable deprecation warnings,
please refer to:https://docs.python.org/3/whatsnew/2.7.htmlTroubleshootingIf 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 toDialog.setup_debug(),
first available in pythondialog 2.12 (theexpand_file_optparameter
may be useful in versions 3.3 and later). An example of this can be
found indemo.pyfrom theexamplesdirectory.As of version 2.12, you can also enable this debugging facility fordemo.pyby calling it with the--debugflag (possibly combined
with--debug-expand-file-optin pythondialog 3.3 and later, cf.demo.py--help).Using Xdialog instead of dialogAs far as I can tell,Xdialoghas not been ported toGTK+version
2 or later. It is not inDebianstable nor unstable (November 30, 2019).
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 fordialog(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 withXdialog, I don’t really support the latter. I test everything with
dialog, and nothing with Xdialog.That being said, here is theoldtext 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
(whichshouldbe found underhttp://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.Historypythondialog 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 theXdialogsupport. Florent Rougon
took over maintainership again starting from 2009…