Is there a Python library that allows to build user interfaces without writing much code?
Asked Answered
E

8

7

I am writing editing front ends in Python since several years now, and I am fed up with micromanaging every UI detail of a window or dialog every single time.

Is there a technology that allows me to, say, specify the relations between a GTK+ Glade-designed interface and the tables and records of an SQLite database to do all the middle man work? It should spare me the work of manually writing event handlers, input evaluators and view updates.

The technologies in question are just examples, but I want to stick with Python as far as possible.

Essayist answered 22/3, 2009 at 22:49 Comment(1)
Additional information, a few months after asking this question: I developed my own solution for the problem underlying above question. Here is the project summary: "Datenwerk is an MIT licensed C library for GNU/Linux and Windows aiming to provide a data/model API for applications which require a model/view/controller pattern. It is best suited for use within music, 3D, vector graphics, scene, video and game editors. Bindings for Python are included.". The project is located at bitbucket.org/paniq/datenwerkEssayist
I
5

Besides the ones already mentioned I can add:

I've never used any of them so have no recommendations but, for what it's worth, I have used at least 2 complex programs built directly on pygtk that worked in both Windows and Linux.

I think Kiwi is the only one of these with baked in support for db (through interface with SQLAlchemy, SQLObject, or Storm) but I would be surprised if you couldn't use one of those ORM's inside any of the other frameworks.

Irons answered 23/3, 2009 at 2:53 Comment(1)
kiwi offers pretty much the functionality i was describing, thank you very much.Essayist
B
4

PyQt and its models can automate some of these tasks for you (to some amount off course, e.g. filling widgets with data from a database and handling most of the widgets behaviour, buffering etc.).

If you want a more object-oriented approach to handling SQL you could look into an ORM-oriented solution (for example SQLAlchemy).

Ballflower answered 22/3, 2009 at 22:58 Comment(2)
Well I hope if library X is doing what I described, I won't even have to use SQLAlchemy much. I'll have a look at PyQt, would still prefer Gtk+ though, for Ubuntu nativeness factor.Essayist
For Gnome nativeness, you mean... you could always switch to KDE if you wanted Qt apps to look more native ;-) (kidding, sort of)Chloric
F
4

Dabo is built on top of wxPython, so you may not prefer it, but it's designed to make it easy to tie a GUI to a database, so I'd recommend you check it out if you haven't already. In particular, it's got good facilities for tying widgets to data, and handling a lot of the common cases of GUI development.

Fults answered 23/3, 2009 at 0:37 Comment(0)
R
1

wxGlade may help, although I haven't used it myself so I don't speak from experience.

Boa Constructor apparently has a wxPython GUI builder in it, and there is also PythonCard, though development on these two projects seems to have stalled.

Receptor answered 23/3, 2009 at 0:4 Comment(0)
D
1

Traits might be a good option for you. http://code.enthought.com/projects/traits/docs/html/TUIUG/index.html

AS simple as it is to map a UI to an object, it doesn't seem too far fetched to incorporate SQLAlchemy for persistence.

Dallman answered 24/3, 2009 at 15:34 Comment(3)
interesting. do you have any personal experience with this library? at first sight it appears like it actually does nothing but busy aristocratic housekeeping. but i keep reading.Essayist
okay i had a look at it. the concept is certainly interesting, but it looks like the UI part does not go very deep, at least judging from the manual.Essayist
My experience with it is pretty light. I mentioned it here because I had the same questions you had when I stumbled on it a couple of months back. This ppt seems to dive deeper into Traits UI capability tinyurl.com/d4rwhpDallman
H
1

There is a good book on wxPython, "wxPython in Action", which can't be said for some of the other solutions. No knock on the others. I've had success developing with wxPython in the past and it comes with a great set of demo applications with source code from which you can borrow liberally.

The best UI designer I found for wxPython applications is a commercial one, Anthemion DialogBlocks. It's by one of the wxPython programmers and is worth the money. Other solutions for UI design include wxGlade (I found it usable but not featureful) and Boa Constructor (haven't used it). Wing IDE might also have one. Stani's Python Editor bundles wxGlade, I believe. There are a lot of other projects that don't really work or are fairly old.

As far as SQL automation goes, as another answerer says, I'd look at SQL alchemy, but the learning curve for a small application might be too much and you'd be better off just going straight to odbc. The best odbc api is the one used by Django, pyodbc.

It's been a while since I developed with these tools, so there may be something newer for each, but at the time these were definitely the best of breed in my opinion.

Hoick answered 27/3, 2009 at 21:41 Comment(0)
Q
0

I had lots of success with wxPython, but that was some years ago now and there may be better new solutions...

Quitclaim answered 24/3, 2009 at 15:43 Comment(0)
B
0

Ok this is an unconventional solution but write yourself a code generator. I have done this several times using Mako. So in my case I auto inspect a table which columns it contains and types and generate classes from that. It's more work upfront but does exactly what you want and is reusable in subsequent projects.

Beaumont answered 19/4, 2009 at 9:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.