Posts

Showing posts with the label dialogs

Rat, more easy PyGTK dialogs

Image
We have been indulging in some Kiwi-love recently. You may have read the recent blog about easy PyGTK dialogs with Kiwi. After a chat with the author of another PyGTK helper library (called rat) and available at http://python-rat.berlios.de/ , who also happens to be a good friend of mine, I have decided to blog a similar example of dialogs using rat. Rat has a similar set of dialogs (a few extra, and a few missing). We shall start with a simple error dialog: >>> from rat.hig import error >>> error('You made a mess in your trousers', ... 'Or maybe the mess was already there', ... title='A big mess!') A similarly simple API, and it gives us a similarly HIG-compliant error dialog: Rat does not contain a yes/no dialog, but it does contain an ok/cancel dialog. Usage is again very quick and simple: >>> from rat.hig import ok_cancel >>> from gtk import RESPONSE_OK >>> r = ok_cancel('Are you s...

Kiwi, Pain free PyGTK dialogs

Image
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 >...