I've been using the Python optimization routines from scipy quite a bit, they appear to work well. I'd like to create a Delphi GUI to make it easier for non-Python users to access the routines for model fitting. I'm aware of Python4Delphi, which I've used in the past to host the Python dll to run simple scripts. I'm not sure until I try, whether this will alllow me to access scipy, presumably it will. I was wondering if any one has other suggestions before I dive in and whether this would even work?

Comments

  1. I do not know python but if you can create a dll with it it would be "easy" to load the dll with Delphi

    A very naive and simple approach would be the following. Create a python console app (let's say, name it engine.exe) that takes input parameters from command line and outputs the results on a file (say a txt or better a json).

    In this way you can create a delphi program (GUI) that can call engine.exe with paramenters, wait for the engine program until he has created the output files and then load the file in Delphi

    So it would be like: Delphi GUI --> python cmd program --> python outputs results on a file --> Delphi GUI loads that file and shows the results

    ReplyDelete
  2. Alberto Miola Nope, that's not how you go about embedding Python

    ReplyDelete
  3. Herbert Sauro What you are proposing works fine. P4D is just a Delphi library wrapper around the C API for embedding Python. The Python installation that you embeds needs to have the scipy library installed, but that's it really.

    ReplyDelete

Post a Comment