views:

1152

answers:

6

I've written a small command line utility in Python (ljdump if you're curious). I originally wrote it for a technical audience who is comfortable with editing textual config files and running Python scripts from the command line. With Python, I don't have to worry about cross-platform concerns very much.

I would like to make this more accessible and provide a simple UI for people for whom any interaction with the command line feels like an alien world. I'm looking for just one dialog box with a couple of input fields, a couple of buttons, and some place to put status.

I'm open to any language, but languages (other than Python, perhaps) that require another heavyweight runtime wouldn't be ideal. I'm thinking something like wxWidgets and C++ would be an acceptable way to do this. If I were to use wxWidgets and Python, what more would a normal Win32 end user need to install to make this go?

Are there any better options? Qt? TkInter? (I suspect TkInter doesn't run natively on OS X and requires an X server.)

Edit: I'm looking at some of the related questions on the right and I think it would be useful to consider my primary requirement to be minimal dependencies.

GUI Programming APIs has some good info on a number of alternatives.

Edit 2: It occurs to me that a dead-simple GUI could be to implement an http server in a Python script (there exist libraries to help with that), and fire up the user's preferred browser in a platform-specific way, pointing to localhost and whatever port the server happens to be listening on. That would certainly be sufficient for my needs. Any thoughts on that?

+1  A: 

Not that I've tried, but I think Tkinter should work on OS X too (maby with addition of Tcl/Tk installed), and is definitely minimal dependency option.

Slartibartfast
+2  A: 

What about wxPython?

Charlie Salts
That doesn't look very lightweight, with a frightening Prerequisites page that is sure to put off potential users. I appreciate the complexity of the enviroment, but it even puts *me* off.
Greg Hewgill
+1. Having tried it (wxPython), I think it's the only sensible choice for a good python GUI.
wxWidgets (and by extension wxPython) is anything but sensible. Cross-platform, yes. Native widgets on each platform, yes. Coherent and full featured API/widgets, not on your life. Don't get me wrong -- it has its place, but I choose to avoid wx if my requirements will permit it.
Steve S
Good to know. It might still be useful in certain situations, though.
Charlie Salts
I'm using wxWidgets for about 5 years now, and it is excellent. But, it does take time to learn to use it well.
Milan Babuškov
+1  A: 

It partly depends on how often you're going to do what. I've messed with wxWidgets several times and I always find a significant learning curve. If you already do HTML stuff with forms, the HTTP server seems like a fine idea, as it will build on what you already know, and in any case the learning curve there is less steep. Plus you win because every user gets to use his or her preferred web browser, it works over the net, and so on.

Norman Ramsey
+4  A: 

Note the Python wiki:

"Tkinter is not the only GuiProgramming toolkit for Python. It is however the most commonly used one, and almost the only one that is portable between Unix, Mac and Windows."

Since it's part of the standard library, it's about your top choice for being lightweight and having minimal dependencies.

I've always found it to be slightly more awkward to use than wxPython, but that's definitely a matter of taste.

David
Thanks, it looks like Tkinter is indeed the right choice here.
Greg Hewgill
+2  A: 

Since the application is written in Python, both TkInter and PyQt are obvious choices. TkInter is already present in most Python distributions and has a small footprint. Qt footprint should be about 5Mb. If you need to support OS X, the main issue with TkInter in the past was that it may not look native enough. Since the introduction of Tile in later versions of Tk, this is much less of an issue.

Daniel Lopez
A: 

consider PythonCard, recently forked because it appears to have stalled on SourceForge. It attempts to be a Hypercard-like easy way to develop GUIs without having to master wxPython concepts. I found it very easy to get started and it includes a good range of samples, mirroring the standard wxPython stress tester.

Andy Dent