@ChadCooper, perhaps I'm overlooking something, but with regard to your 3rd case:
A Python script that launches a PyQT/wxPython/Tk GUI..
Is there a reason why you couldn't use the .Net Process API (see
System.Diagnostics) to execute your custom Python script over Standard In/Out? Of course, this sort of architecture will assume a proper version of Python is installed and equipped with any additional libs you require. I think you'd just want to extend an
ICommand object and use the Process API in its
Click() event. This example (which was an experiment only) called a .py script that used dbfpy to read the columns in a DBF file and return them as a list to a .Net application.
private static List<string> _readDbfOutput;
public static List<string> ReadDbfTable(string dbfPath, int limit)
// start a fresh output object..
_readDbfOutput = new List<string>();
string executable = "C:\Python27\python.exe";
string fullUtilPath = "C:\some_app\utils\read_dbf_table.py";
// The path to the python file and it's arguments become a single input
// submitted to the python runtime. In this case, I've got somethign like:
// C:\>C:/Python27/python.exe C:\some_app\utils\read_dbf_table.py -f C:/data/some_shapefiles.dbf -l 100
// dbfPath and limit were method arguments..
string exeArguments = fullUtilPath + " -f " + dbfPath + " -l " + limit.ToString();
ProcessStartInfo startInfo = new ProcessStartInfo(executable, exeArguments);
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true; // necessary if you need to listen..
startInfo.RedirectStandardInput = false; // necessary if you send more inputs..
startInfo.StandardOutputEncoding = System.Text.Encoding.ASCII;
Process proc = new Process();
// ReadingDbfTable is my redirected standard input..
proc.OutputDataReceived += new DataReceivedEventHandler(ReadingDbfTable);
proc.StartInfo = startInfo;
// WaitForExit() may need to be wrapped in a Try or Using block.
// Will it run indefinitely if the script fails?
/// Handle redirected STDOUT.
private static void ReadingDbfTable(object sendingProc, DataReceivedEventArgs stdOutput)
if ( ! String.IsNullOrEmpty(stdOutput.Data) )