Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

itsmrjon

macrumors regular
Original poster
Jun 11, 2011
122
0
Chicago
So for those of you very familiar with GUI's in Python, I'd like to ask a few questions about a starting point. I'm attempting to write a rather simple GUI for an F95 CFD code I have. All it really needs is a few checkboxes and some simple prompts which will then either be written to a text file (the bump file as we call it) or I may attempt to use F2PY. Nonetheless, here are the questions:

1) Since the program will be run on both Linux (Redhat) and OSx machines, which GUI framework would you recommend? Ease of use and minimal dependencies are my goal (these codes are run on supercomputers, so I may not have appropriate permissions to install additional software)

2) What are some good reference materials (more than just the tutorials on the host site)? Preferable in depth tutorials as I have very little experience with Python.

3) Does anyone have experience with F2PY? Is it a good option?

4) Anything additional you'd like to throw in? Warnings, recommendations, flaming etc?

Thanks in advance!
 

ytk

macrumors 6502
Jul 8, 2010
252
5
I can't answer the rest of your questions (I'm more of a Ruby type) but as for question 1, have you considered using curses? Your interface will be... functional, at best, but it's the only GUI framework I know of that you can pretty much be assured will run—and look the same—damn near anywhere. As an added bonus, you can run it over an ssh connection with very little hassle, which might prove useful if you're running it on a supercomputer.
 

blueillusion

macrumors member
Aug 18, 2008
56
3
I use PySide : http://www.pyside.org/

It's an officially supported gui toolkit that hooks into the Qt C++ framework.
The documentation section gives you a thorough set of examples to play with, and has an endless amount of written documentation.

Pros:
-Officially supported
-Cross platform
-Look and feel (almost) identical to your running host
-Virtually can take existing Qt C++ code, rewrite it in python syntax, and it will work

Cons:
-Potential steep learning curve (especially if you dont know what Qt is already)
-Can be a pain to get pyside packages on older distro builds (eg Ubuntu lucid 10.04 lts)
-The Modal/View widgets are really over-engineered, so it's not to easy to deal with custom TableViews and grid views.

I use Qt, Python and Obj-C on a daily basis, so transitioning to PySide from Qt C++ literally only took about an hour.

I know you said you are new to python, but im not sure if you already have used some gui toolkits already. If you have, you should be able to use PySide fairly quickly. If not, then you will have a steep learning curve no matter which toolkit you choose.

EDIT:
Just noticed that you said you might not be able to install extra packages on your deployment targets.
If that's the case, then TKinter is probably the safest choice as it is included with python already
 
Last edited:

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
This isn't answering the question directly, but I thought I'd toss this out there. I'd be inclined to drive the configuration of your fortran program using text files. If people want to write scripts themselves, it's easy. If someone wants to make tweaks, no problem. You want to write a GUI? Do it with whatever tool you want, generate the text file, done. You could invoke the fortran program with the file you generate if you'd like to "integrate" the process.

This lets you use any GUI tool, the GUI could be run elsewhere and the file could be copied to your big machine for use, you can copy config files between dev/test/production easily, if there's a problem you can have the user send you the file they ran with, etc.

I don't think tightly integrating a GUI config with an otherwise "headless" app on a supercomputer makes a lot of sense.

-Lee
 

itsmrjon

macrumors regular
Original poster
Jun 11, 2011
122
0
Chicago
I can't answer the rest of your questions (I'm more of a Ruby type) but as for question 1, have you considered using curses? Your interface will be... functional, at best, but it's the only GUI framework I know of that you can pretty much be assured will run—and look the same—damn near anywhere. As an added bonus, you can run it over an ssh connection with very little hassle, which might prove useful if you're running it on a supercomputer.

Honestly I never even considered it, but this is a great and potentially genius option! It would prevent us from having to run an xsession on the host machine. I'm going to look into this more.

This isn't answering the question directly, but I thought I'd toss this out there. I'd be inclined to drive the configuration of your fortran program using text files. If people want to write scripts themselves, it's easy. If someone wants to make tweaks, no problem. You want to write a GUI? Do it with whatever tool you want, generate the text file, done. You could invoke the fortran program with the file you generate if you'd like to "integrate" the process.

This lets you use any GUI tool, the GUI could be run elsewhere and the file could be copied to your big machine for use, you can copy config files between dev/test/production easily, if there's a problem you can have the user send you the file they ran with, etc.

I don't think tightly integrating a GUI config with an otherwise "headless" app on a supercomputer makes a lot of sense.

-Lee

This is currently the way we do it for the most part. We hand write our bump files which are read by the program to run the case. I currently have a matlab program that writes the bump files, but running matlab everytime I want to setup a new case is a pain.

You're right, I may stay away from f2py all together just to keep the portability.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
I've also given kivy a shot, rather steep learning curve for a guy who spends most of his time writing FORTRAN :eek:

Well, actually I found it somewhat more straightforward than other python GUI packages. I remember having problems getting Tk/Tkinter to install on Linux, dependencies were always a problem.

My main issue with kivy was that they use OpenGL optimization, which makes a simple hello world program trigger the discrete GPU on OSX.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.