GUI interface for sqlite data entry in Python GUI interface for sqlite data entry in Python sqlite sqlite

GUI interface for sqlite data entry in Python


Since you're interested in future integration with a web application, you might consider using a Python web framework and running the app locally on your machine, using your web browser as the interface. In that case, one easy option would be web2py. Just download, unzip, and run, and you can use the web-based IDE (demo) to create a simple CRUD app very quickly (if you really want to keep it simple, you can even use the "New application wizard" (demo) to build the app). It includes its own server, so you can run your app locally, just like a desktop app.

You can use the web2py DAL (database abstraction layer) to define and create your SQLite database and tables (without writing any SQL). For example:

db = DAL('sqlite://storage.db')db.define_table('customer',    Field('name', requires=IS_NOT_IN_DB(db, 'customer.name')),    Field('address'),    Field('email', requires=IS_EMAIL()))

The above code will create a SQLite database called storage.db and create a table called 'customer'. It also specifies form validators for the 'name' and 'email' fields, so whenever those fields are filled via a form, the entries will be validated ('name' cannot already be in the DB, and 'email' must be a valid email address format) -- if validation fails, the form will display appropriate error messages (which can be customized).

The DAL will also handle schema migrations automatically, so if you change your table definitions, the database schema will be updated (if necessary, you can turn off migrations completely or on a per table basis).

Once you have your data models defined, you can use web2py's CRUD system to handle all the data entry and searching. Just include these two lines (actually, they're already included in the 'welcome' scaffolding application):

from gluon.tools import Crudcrud = Crud(db)

And in a controller, define the following action:

def data():    return dict(form=crud())

That will expose a set of pre-defined URLs that will enable you to create, list, search, view, update, and delete records in any table.

Of course, if you don't like some of the default behavior, there are lots of ways to customize the CRUD forms/displays, or you can use some of web2py's other forms functionality to build a completely custom interface. And web2py is a full-stack framework, so it will be easy to add functionality to your app as your needs expand (e.g., access control, notifications, etc.).

Note, web2py requires no installation or configuration and has no dependencies, so it's very easy to distribute your app to other machines -- just zip up the entire web2py folder (which will include your app folder) and unzip it on another machine. It will run on *nix, Mac, and Windows (on Windows, you will either need to install Python or download the web2py Windows binary instead of the source version -- the Windows binary includes its own Python interpreter).

If you have any questions, there's a very helpful and responsive mailing list. You might also get some ideas from some existing web2py applications.


I normally use GTK+ that has well documented Python bindings.

The biggest advantage is that you can use a fairly intuitive GUI editor (Glade) and automagically link callbacks to events (to be honest most other major graphical toolkits have this possibility too, like for example QT, but my perception is that GTK+ enjoys wider adoption in the Python community). EDIT: additionally GTK is used by Gnome and many other desktop environments (KDE uses QT though).

That said, if all you need is truly just data insertion from a trusted person, you could use something already done like SQLite manager (it's a FireFox plugin).


Radically alternative solution: use django and you can literally pass from reading the tutorial to have your app up and running in a matter of hours, inclusive of user authentications, back-end administrative interface etc. (your project is exactly what I did with it to allow my wife to insert expenses in our family budget).

Django is written in Python and you can use SQLite as a back-end.