Gnu/Linux dialogue boxes in python

Paul Boddie paul at boddie.org.uk
Fri Nov 30 09:35:59 EST 2007


On 30 Nov, 14:55, Donn Ingle <donn.in... at gmail.com> wrote:
> Hi,
>  Okay, so I am in the mood to try this: Inform the user about what modules
> the app requires in a graphical dialogue that can vary depending on what
> the system already has installed. (It will fail-to output on cli)
>
> I am running Kubuntu and I seem to have 'kdialog' installed by default (not
> sure if it came as stock.)

I think it's part of KDE. You can check by doing something like...

dpkg -S kdialog

That should tell you about the package which provided it, which is
possibly one of the KDE packages.

> What other 'stock' systems are there out there in the wild? Ubuntu? Suse?
> Fedora? Others?

There's Xdialog which is the old-fashioned graphical dialogue tool and
Zenity: the oddly named GNOME successor to gdialog. See this article
for some details:

http://www.linux.com/articles/114156

> I would take a stab at wrapping them in python so that I can use the first
> dialogue system found to popup messages for the user.
>
> (Hoping, natch, that this has already been done ... ? )

I wanted to do this for the desktop module [1], but without any
obvious dialogue tool support for Windows, I didn't proceed any
further than a simple wrapping around KDialog, Zenity and Xdialog,
since the aim is to cover more than the usual UNIX-like platforms.
However, I could make that code available separately, or someone could
tell me how Windows and Mac OS X manage to perform the same tricks.
Perhaps some nasty win32 API dialogues need to be created by hand on
Windows - something which I certainly have no interest in doing, but
someone might find it exciting work.

I thought that there was another package out there which wrapped these
programs, but I can't seem to find it right now. It's certainly worth
trying to make a generic interface, though, since the features
provided by each of the programs do differ in certain important ways
which you might not care too much about if you only really care about
portability. For example, if you want to have a list of choices, I
seem to recall that KDialog offers much more flexibility than Zenity
(whose method of presenting various things is fairly awful at times),
but the lowest common denominator might well be better than reading up
on all the options for each of the programs and coding something up
yourself.

Paul

[1] http://www.python.org/pypi/desktop



More information about the Python-list mailing list