Fog Creek Software
Discussion Board




The best of two goodies...

Hi all, just want to let you guys know that i recently started exploring a combination which turns out to be a 'killer-combo'

Delphi & Python

I really love both languages and combining them is just great and very easy to accomplish. Python has some nice GUI-toolkits but they 'fade' away compared to the perfect Delphi IDE. I can now use Delphi to build a robust GUI and design a complete class-framework in Python in no-time. It only requires 1 extra DLL-file for distribution. That's it.

Really, I reccomend it very much and am still really excited about it's possibilities.

check it out:

http://membres.lycos.fr/marat/delphi/python.htm
http://www.atug.com/andypatterns/pythonDelphiTalk.htm


Do you guys&girls have any experience with these kind of combinations?

Guyon
Wednesday, November 20, 2002

Looks cool.

Will the Dlls allow Python scripting in Delphi apps, like Jython does for Java?

Ged Byrne
Wednesday, November 20, 2002

i have no experience with Jython or JAVA so i can't really tell you that. I am also just strating with it.

But you can _easily_ instantiate Python classes in Delphi with the help of a 'Variant' type.:

var
  Module, Class : Variant;

begin
Module := Import('myModule.py');
Class := Module.myClass()

Class.doAnyOperation();
end;

dead simple :)

Guyon
Wednesday, November 20, 2002

I don't know much about Python, but why you reserve Delphi only for the presentation ?

Having developped a lot in Delphi (years ago), the Pascal Object seems good enough any OO development for any domain.

Can you precise what you consider a killer feature of Python you need and couldn't do with Delphi ?

Robert Chevallier
Wednesday, November 20, 2002

Sure, I'll have to admit it's 'preference' kind of thing ;)

Serious, everything I do in Python I can surely accomplish in Delphi, too. But Python is just such a great, clear and consistent language and I prefer 90% of it's 'ways' high above Delphi and am way more productive in Python then in Delphi. I'm not gonna tell very much about Python here, but I think programmers should give it a shot http://www.python.org/ . You become to love it ;)

Take this 'preference-factor' and add to that the extremely easy way of combining the two... anyway, I think it's great.

Guyon
Wednesday, November 20, 2002

This looks like Good Stuff.

I tinker with Python a little bit and like it a lot.  Delphi is on my list of "things to investigate someday" but I may have to move it up in the queue based on this (and a student software discount next semester, heh).

The whole thing fits in 900KB?  That is impressive.

Anyway, thank you for sharing.

Matt Conrad
Wednesday, November 20, 2002

Is there a Kylix version?

Ged Byrne
Thursday, November 21, 2002

Oh, And I take it these controls are good for C++ builder too. 

Ged Byrne
Thursday, November 21, 2002

i'm not sure about C++ builder, check the links in the parent post. I think I read somewhere on the site that it is Kylix compatible, but not sure...

Guyon
Thursday, November 21, 2002

As a Delphi developer who is a recent convert to Python let me add my $0.02.

Delphi is very strong in rapid GUI design. However, as is so often the case, the examples and the tool itself have a tendency to lead you into mixing your application functionality into the GUI classes. This inevitably causes problems when you need an Object to do something and its inextricably tied to a form class.

Delphi's support for classes is good but creating a list of objects requires you to create a wrapper around a TList and do a lot of typecasting to the things you put on the list.

Delphi requires you to be careful about resource allocation. Creating leaks is easy if you don't .free objects.

Delphi can do something like Pythons runtime method resolution by declaring an Interface and then having your Delphi class declare and implement the method signature of that Interface.

In all, Delphi is an excellent language but when I code in Delphi I really miss the things that make programming in Python pleasant : Built in powerful container classes, runtime discovery, flexible parameter passing etc.

I propose that writing your core classes in Python and using Delphi for your GUI could cut the amount of typing you do by a factor of 10. Not to mention the ability to port your application to one of the following if they reach prime-time :

BoaConstructor could be the Python/wxWindows Delphi.

BlackAdder could be the Python/QT Delphi.

Ian Sparks
Thursday, November 21, 2002

I could see this being real good for Python as well.

One of the big problems with Python is the distribution of apps you've written. 

With the combination of a 900k dll and a delphi generated executable the distribution of Python developed apps becomes a whole lot easier to the windows world.

With static linking, it may even be possible to generate a single exe.  That would be cool.

Ged Byrne
Friday, November 22, 2002

Ged, take a look at the Python Installer from Gordon McMillan.

[ http://www.mcmillan-inc.com/install1.html ]

It bundles your Python app with all its dependencies into one executable (or one directory, or whatever you want). And it has been doing it for the past 5 years or so.

Ori Berger
Friday, November 22, 2002

Ori,

Cool.  Thanks.

  Ged.

Ged Byrne
Friday, November 22, 2002

Has anybody tried to combine VB GUI's with python?

Raúl
Monday, November 25, 2002

Take a look at Mark Hammond's "Python programming for Win32" book. You will find financial applications there using VB for the GUI and Python for all the application logic. He has also developed the win32 packages for Python that allow you to interact with any COM objects and you can manipulate any Excel or Word document through Python.
Activestate's Python installation comes with all these packages by default and also with a nice Python IDE. Check out  www.activestate.com  .

Hemanth P.S.
Monday, November 25, 2002

Great answer!!!

Thank you very much, Hemanth!!!
:-)

Raúl
Monday, November 25, 2002

Did any one created his/her own Python IDE in Delphi and wants to show it to the community.

I am working on one and would like to know if someone has found, or has a good system for autocomplete for Python code and detection of Python classes.

Why I am creating a IDE for Python in Delphi? Well I want to see if it can be done and I am not really happy with the available IDE's if they where all combined in one it would be good. In one IDE I miss autocomplete and the other one I miss autocomplete.

But for the rest; I am quite happy with the Python for Delphi components. Keep up the good work.

Marc

p.s. the components work also correct with Delphi 7 (not tested with Delphi 8 yet).

Marc Witteveen
Friday, February 27, 2004

*  Recent Topics

*  Fog Creek Home