My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members
Featured
Downloads
Links

Overview

formlayout is a tiny Python module for creating form dialogs/widgets to edit various type of parameters with having to write any GUI code (it requires Python 2.x and PyQt4 4.y, with x >= 5 and y > 3).

The main advantage of formlayout over similar libraries is that it's very simple to use/install and that it's so light (it just needs PyQt4 to run). However, if you are looking for more advanced automatic GUI generation, try the guidata library: this is an incredible combination of simplicity and power (and its compatible with PyQt4 and mostly with PySide too).

Installation

formlayout requires Python 2.x and PyQt4 4.y, with x >= 5 and y > 3:

  • All supported platforms (GNU/Linux, MacOS and Microsoft Windows XP/Vista): install Python and PyQt4
  • Microsoft Windows XP/Vista: note that Python(x,y) (scientific-oriented Python distribution) includes formlayout as a standard plugin
Installation instructions:
  • Python(x,y): nothing to do, it's already included
  • Without setuptools: download the .tar.gz file, extract files and type python setup.py install
  • With setuptools: simply type easy_install formlayout

Simple example

The main feature of formlayout is to provide the fedit function which transforms a list of parameters into a GUI-based form (you may also create a list of parameter lists - see formlayout.py for more advanced examples):

from formlayout import fedit

datalist = [('Name', 'Paul'),
            ('Age', 30),
            ('Sex', [0, 'Male', 'Female']),
            ('Size', 12.1),
            ('Eyes', 'green'),
            ('Married', True),
            ]

print "result:", fedit(datalist, title="Describe yourself",
                       comment="This is just an <b>example</b>.")

Here is the generated GUI dialog box:

And here is the result return by fedit:

[u'Paul', 30, 'Male', 12.1, u'#008000', True]

That's all!

Advanced example: Pydee

formlayout is used in Pydee (project renamed to Spyder in 2009) to implement the matplotlib settings dialog box:

Integration in Pydee (http://code.google.com/p/pydee/):

Powered by Google Project Hosting