I have always been frustrated that python does not have a nice GUI builder similar to what XCode provides. Since I am a scientist and engineer, I am really fond of the combination matplotlib/scipy/numpy. Here I will give an example of how to combine the two using the python cocoa bridge that is build into the python that comes with the operating system (in my case Mountain Lion OS X 10.8). The only thing that you need to install for this example to work is the SciPySuperpack.
Here is the link to my example: github.com/hstrey/ShowMatPlotLib
Here is how it’s done. The basic idea is that the python code creates a png file of the graph and that this graph is sent to the Cocoa program via a NSData object. I then convert NSData into a png image and display it. To show how fast this happens, I added a slider to change the frequency of the sine function that is being displayed. Every time you change the setting a new graph is created and displayed. This technique is not suitable for graphs that need to change dynamically at a high frame rate but for most applications it should work.
First the Cocoa part:
//
// SMPLAppDelegate.m
// ShowMatPlotLib
//
// Created by Helmut Strey on 4/23/12.
// Copyright (c) 2012 Stony Brook University. All rights reserved.
//
// Global pointer to app delegate
SMPLAppDelegate* myprogram;
// sendGraph function for sending graph through NSData
PyObject*
static PyMethodDef sendGraphMethods = ;