views:

124

answers:

2

I'm interested in doing rapid app development in Python. Since this is mainly for prototyping purposes, I'm looking for a way of creating "rough" user interfaces. By this, I mean that they don't have to look professional, they just have to be flexible enough to make it look the way I want. Originally I was going to do this by creating a GUI (using something like GTK), but now I'm starting to think about TUIs (using ncurses).

What are the differences between creating a GUI versus a TUI? Would I be able to create the interface faster in pyGTK or Python's curses module?

A: 

pyGTK is a lot more than curses. It includes an event loop, for one. If you're going to create TUIs, at least use something comparable, like urwid.

nosklo
A: 

If you are looking for a simple way to mockup a simple GUI, you might consider using a lightweight web framework like flask: http://flask.pocoo.org/. You'll have access to a range of standard widgets (buttons, picklists, textboxes, etc.). Just plain HTML is perfectly usable while you're focusing on the functionality of whatever you're building and you can add some CSS later to make things pretty.

Consider how a "Hello world" app in flask (below, taken from the project home page) compares to this 80 line pyGTK example: http://www.pygtk.org/pygtk2tutorial/examples/helloworld.py.

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

The web development route spares you much of the boilerplate work involved with desktop GUI development.

AndrewF
Not downvoting, but most of the content of the pyGTK example you link though are comments. A hello world example in a modern, mature GUI toolkit most of the time won't be 80 lines long. Here's a PyQt example in 6 (not counting the she-bang): http://coreygoldberg.blogspot.com/2009/12/python-pyqt4-hello-world.html.
ChristopheD