Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top