Sign in Join
Wiki copytemporary

Python4Delphi: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Overview
22
3-Current home: <https://code.google.com/p/python4delphi/>
3+Current home: <https://github.com/pyscripter/python4delphi>
44
5-From that page:
5+From that page:
66
7-> Python for Delphi (P4D) is a set of free components that wrap up the Python dll into Delphi and Lazarus (FPC). They let you easily execute Python scripts, create new Python modules and new Python types. You can create Python extensions as dlls and much more. P4D provides different levels of functionality:
8->
9-> - Low-level access to the python API
10-> - High-level bi-directional interaction with Python
11-> - Access to Python objects using Delphi custom variants (VarPyth.pas)
12-> - Wrapping of Delphi objects for use in python scripts using RTTI (WrapDelphi.pas)
13->
14-> P4D makes it very easy to use python as a scripting language for Delphi applications. It comes with an extensive range of demos and tutorials.
7+> Python for Delphi (P4D) is a set of free components that wrap up the Python dll into Delphi and Lazarus (FPC). They let you easily execute Python scripts, create new Python modules and new Python types. You can create Python extensions as dlls and much more. P4D provides different levels of functionality:
8+>
9+> * Low-level access to the python API
10+> * High-level bi-directional interaction with Python
11+> * Access to Python objects using Delphi custom variants (VarPyth.pas)
12+> * Wrapping of Delphi objects for use in python scripts using RTTI (WrapDelphi.pas)
13+>
1514
16-The [changelog](https://code.google.com/p/python4delphi/source/list) indicates development was last active around Nov 2012.
15+>
16+> P4D makes it very easy to use python as a scripting language for Delphi applications. It comes with an extensive range of demos and tutorials.
1717
18-[The commit from 21.1.2018 claims the compatibility with both Lazarus and (hopefully) Delphi Linux](https://github.com/pyscripter/python4delphi/commit/88c06f11e70d471fc5dfd3b1e7e446c09eb5ab9a)
18+The [commit log](<https://github.com/pyscripter/python4delphi/commits/master/>) indicates development is active as of Sep 2024. Lazarus lpk files and demos exist.
1919
2020# Lazarus port
2121
2222Lazarus port: [[Using Python in Lazarus on Windows/Linux]]
2323
2424# See also
2525
26-- Old wiki (~2006) with lots of examples at [py4d.pbworks.com](http://py4d.pbworks.com/w/page/9174525/FrontPage)
27-- [Yahoo group](https://groups.yahoo.com/neo/groups/pythonfordelphi/info)
28-- Notes from a [Python for Delphi talk](http://www.atug.com/andypatterns/pythonDelphiTalk.htm)
26+ * Old wiki (~2006) with lots of examples at [py4d.pbworks.com](<http://py4d.pbworks.com/w/page/9174525/FrontPage>)
27+ * [Yahoo group](<https://groups.yahoo.com/neo/groups/pythonfordelphi/info>)
28+ * Notes from a [Python for Delphi talk](<http://www.atug.com/andypatterns/pythonDelphiTalk.htm>)
2929
3030# FreeBSD
3131
32-I was able to get this working on FreeBSD without relying on Lazarus design-time components:
33-
34-``` pascal
32+I was able to get this working on FreeBSD without relying on Lazarus design-time components:
33+```
3534program simplefpcdemo;
36-uses PythonEngine, dynlibs;
37-
38-var eng : TPythonEngine;
39-begin
40- eng := TPythonEngine.Create(Nil);
41- eng.LoadDll;
42- if eng.IsHandleValid then
35+ uses PythonEngine, dynlibs;
36+
37+ var eng : TPythonEngine;
4338 begin
44- WriteLn(' evens: ', eng.EvalStringAsStr('[x*2 for x in range(10)]'));
45- eng.ExecString('print "powers:", [x**2 for x in range(10)]');
46- end
47- else writeln('invalid library handle!', dynlibs.GetLoadErrorStr);
48-end.
39+ eng := TPythonEngine.Create(Nil);
40+ eng.LoadDll;
41+ if eng.IsHandleValid then
42+ begin
43+ WriteLn(' evens: ', eng.EvalStringAsStr('[x*2 for x in range(10)]'));
44+ eng.ExecString('print "powers:", [x**2 for x in range(10)]');
45+ end
46+ else writeln('invalid library handle!', dynlibs.GetLoadErrorStr);
47+ end.
4948```
5049
51-The output:
52-
53- evens: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
50+The output:
51+```
52+evens: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
5453 powers: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
54+```
5555
5656My personal working copy (including a Python wrapper for my terminal library) is <https://github.com/tangentstorm/py4d> .
5757
5858---
59-*From the Free Pascal wiki, page "Python4Delphi", as it stood on 2023-06-03 after a change by AMXS52, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
60-Category: FreeBSD
61-Category: Linux
62-Category: Other programming languages
63-Category: Python
64-Category: Windows
59+*From the Free Pascal wiki, page "Python4Delphi", as the Internet Archive kept it on 2025-06-05, last changed on 2024-09-19. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history