Kiwi, Pain free PyGTK dialogs

Since we are in love with Kiwi, we will mention another amazing thing it has done for us. HIG Dialogs. HIG are the (Gnome) Human Interface Guidelines, a set of guidelines for creating accessible user interfaces. I wish we could ignore these things, but unfortunately we can't. You can read about them here.

Kiwi has a set of dialogs ready for us that conform to these guidelines. They are presented in the form of funcitons that you can call, and which give you a response of some kind. Let's have a look:


>>> from kiwi.ui.dialogs import error
>>> error('You screwed something up',
... 'Or maybe it was already screwed to begin with')


Yes, it is as simple as that. None of that boilerplate code. And the dialog itself actually looks quite nice:

The error dialog is not the only one available of course. You have error, info, save, open, and my favourite: yesno


>>> from kiwi.ui.dialogs import yesno
>>> from gtk import RESPONSE_YES
>>> resp = yesno('Are you sure you want to install this virus?')
>>> resp == RESPONSE_YES
True


Again, nice and quick. You will find yourself adding these dialogs all over the place, maybe even in too many places. But it's all good, as long as the user knows what is what.

Popular posts from this blog

PyGTK, Py2exe, and Inno setup for single-file Windows installers

Kiwi proxy widgets, a common widget API

Using threads in PyGTK