Replay from part 1 of the Python for Delphi Developers. Be sure to register for Part 2!
Agenda
- Motivation and Synergies
- Introduction to Python
- Introduction to Python for Delphi
- Simple Demo
- TPythonModule
- TPyDelphiWrapper
A few useful links
- Python4Delphi library
- SynEdit library
- Python for Windows Download
- PyScripter IDE for Python written in Delphi using Python4Delphi and SynEdit
- Python Tutorial: How to Think Like a Computer Scientist with Python 3 and PyScripter
[Replay]
Sample code (on GitHub)
- SimpleDemo
- ModuleDemo
- WrapDelphiDemo
- Demo31 Using WrapDelphi to access Delphi Form attributes
Be sure to register for part 2.
Q&A Log
Question Asked | Answer Given |
Ahoy hoy | We are starting now! |
Thanks for webinar | It is very exciting. |
Hi everyone ! | |
How many participants do we have? | A lot! There is a lot of interest. |
Hi! I can’t download the sources, they’re tagged as malware by Chrome | That is unfortunate. Does Chrome give you the ability to bypass the warning? It is just slides and source code. No executables. |
The first speaker’s sound quality is poor. | Yes, sorry, Luckily I don’t talk too much, I’ll fix it though. |
TIOBE – lol | Always good for a laugh |
couldn’t bypass the warning, but Firefox downloaded the sources like a charm 😉 | Good ol’ Firefox! Glad you were able to download them. |
Is it possible to use it under Linux64? | yes. Win32, Win64, macOS, and Linux 64 are supported. SupportedPlatforms |
in chrome it is simply to allow it to downolad, use dropdown button | nice to know |
I don’t see the slides in the download zip | They are a PDF |
thank you for the download link! | Welcome |
why do I get “Sorry, this portion of the webinar cannot be viewed on your device”? | Very odd. Sorry about that. Not sure why you would get that. I’ll be sure to get you a replay link via email. |
Any problem? | No problems on this end. |
hi everyone | Hello |
I haven’t done much with python yet, but Python is also available on the Windows Store. One click install/uninstall might be handy. | True. |
Good Topic, I am impress | I am learning a lot as well. |
If I wanna use python in a client application – exe for Windows (10) then do I need to have python installed on the client machine? | Yes. You can either distribute Python with your application or require them to install it. |
Getting lots of Class Errors e.g. TSynEdit not found error messages when trying to run the demos. Am i doing something wrong? | TSynEdit is available in GetIt, you need to install that first. |
(the exe is distributed to the client) | Just include Python with your EXE |
could you please paste here the links please? | https://github.com/pyscripter/python4delphi |
Will this integration work in an Isapi Dll running on IIS? | It should. |
hi, i’d like to ask about multithread application – can i initialize python.dll for each delphi thread and execute code parallel ? | That is covered in part 2 |
How can we get SynEdit components? Is it open source? | It is Open Source and available via the GetIt package manager in the IDE or download it here Synedit |
Requirement is not a option unfortunately. What Python distribution I can include in my application installation? What is its size ? MB , GB ? Thanks | Get the 8 MB |
Does the end users need to have Python installed on the target machine? | Either the end user needs it pre-installed or you can distribute the Python DLL with your application. |
Where to get that Synedit? It isn’t included with Py4D, is it? | TSynEdit is in the GetIt Package manager in the IDE and available here |
Is it possible to run python script inside a thread? | Yes, but we will cover that in more details in the next webinar. |
Could you explain how the python components are installed | I’ll add detailed installation steps and more details here |
Good Morning..JS | |
Thanks! | |
Will the replay be available for this session please | Yes, You will get an email with the replay and I will post the replay for both halves and additional resources here |
It is fantastic! | agreed |
One way I hope would be available for shipping the dll compiled inside the exe as a resource and then extract it at runtime either to some temp folder or use it as a in- memory extracted resource | In theory you could do that. |
In CAD app Rhinoceros they use some short version of phyton called iron phyton for plugin creation. Is it possible to mix this short library with Delphi and to create a plugin with Delphi? | Yes |
for, in, import – keywords are not highlighted | There was something wrong with the Syntax highlighting there. That is what happens with Live Demos. |
Do we need to add a path to python in the project options? | There are a few options for redistribution. |
what happens if the syntax is wrong? | It will provide feedback on errors and you can handle that in your program |
1. will you include a link to this simple example demo in the link? 2. can i use this in C++ Builder also? | Here are all the samples, and most of the functionality should work from C++Builder |
Is Threading supported? | There is a multithreaded demo shortly. |
Hello | |
Is there a way to manage different instances of python from delphi application or is it one delphi app with only one-python instance? | You can manage that from the TPythonEngine |
can I use it in web app? | In theory. You have some additional concerns with web applications, so you would need to be careful with your threading model, but if you are careful then it should work just fine. |
What a good presenter is he! | yes |
Will this work with C++Builder too? | Most of the functionality should work with C++Builder. |
hehe, I guess Delphi would allow the creation of much better visual interfaces than tkinter 😉 | Oh yeah, I went and explored the Python options for creating GUI and they reminded me of pre-Delphi GUI creation. Delphi is fantastic at adding GUI to a Python application. |
how python exceptions are handled? are pyc created when script executed? If no, then second execution i python is faster than in delphi | The component traps the errors and converts them into Delphi exceptions for you to handle. |
I need to implement a Listener for Firebase, I was able to install python and library, but I couldn’t leave the python code running | |
Have you compared that python timing to compiled python code? | Compiled Python would be faster than demoed, but there are other performance improvements via the parallel library. So there are always options for improving performance. |
I need to implement a Listener for Firebase, I was able to install python and library, but I couldn’t leave the python code running | |
is there a limitation of imported python libs? for example can we import opencv, matplotlib, scipy, scikit? | Yes, you can use all of those. |
Maybe I missed to info about “required distribution size” which could be included in end users delphi application installation. | about 8 MB |
Is it possible to pass variables from Delphi to Python ? | Yes |
Does SynEdit / TPython__ components supports Delphi Seattle ? | yes. |
Very impressive! If I have seen right there are some restrictions on FreePascal/Lazarus in the moment about variant change handling. | yes |
Exactly that’s my problem 🙂 the few options for redistributions. I need to find the minimum sized one for the end user. | Use the embeddable version and it is very small |
How does Python know where to get the delphi_module? | For the demos today it tells it, but in the next webinar we will show how to create modules for use outside Delphi. |
Can I use interactions with Python from Delphi 10.3.3? | yes |
It works also with Berlin? | yes |
Will this “Questions” feed be available later? There are some good bits on here. | Yes, I will include them in the blog post with the replay |
Can I pass delphi object to python and call object methods in python? | yes, demonstrating a Record shortly, but can do with Object and Record too. |
Amazing | Agreed |
It would be interesting to see how you could build DLLs in Delphi that you call from pure Python; outside Delphi. | I believe that will be covered in the 2nd part in 2 weeks. |
?? | 🙂 |
When is the next session? | in two weeks at the same time. You are already registered |
Is it multithreading capable? | yes |
If I want to distribute the Python DLL’s and some libraries together with my application in some subdirectory, how do I tell the system in which path these libraries are located? | Yes, via TPythonEngine |
I am really impressed with the speaker and the way he can manipulate the screen by zooming in and folding into next page. How does he do that, please? | |
It would be interesting to see output for delphi object Ref: print(type(Ref)) print(dir(Ref)) print(help(Ref)) | they are Python types |
Comparing python against delphi execution timings looks really awkward from people desparetaly needing those tensorFlow, anaconda, panda and whatever python libraries. Do I really need delphi? | Delphi makes it easy to build the GUI and then call ingot TensorFlow Python libraries etc.,Delphi makes it easy to build the GUI and then call ingot TensorFlow Python libraries etc. |
really nice and simple to use 🙂 | |
Really amazing stuff! | agreed |
Will the recording of this session be freely accessible? | Yes. I’ll post them |
Hello! Does this library (Python4Delphi) allows you to seamlessly link and used python module and library ? Numpy for example? | yes. We will cover that in more details in the next session. |
Can you show a Phyton Big Data function example, like SVM Support Vector Machine) being called frm Delphi and returning results to Delphi ? | Yes, in the next session. |
thanks – that was really interesting | agreed |
Great stuff!! Thanks! | agreed |
Right decision to split it into two sessions! First part was very informative, fastly and heavy enough 🙂 | Yes, we quickly realized this was going to be too much for one session. May end up doing more sessions in the future too. |
Thank you very much, very interesting! | |
Great one!, will eagerly look forward to next session. Thankyou all of you for this great effort | |
I understand you can use any IDE? like PyCharm? | Yes |
By distributing this DLL then you can avoid installation of Python in the target machine right? How big this Python DLL actually is? | Less than 8 MB |
A small FMX demo please. | We will ahve one in the next session. |
Thank you, excellent demo!!!! | |
Delphi + Python + Docker…. that would be interesting | Sure, easy enough,Sure, easy enough |
it is possible to use a python modul? | yes |
Jim and Kiriakos: Just to clarify for the audience … “Python4Delphi” is _not_ a cross-compiler of Python for Delphi … Instead, this project is definitely designed for the _simultaneous coexistence of Delphi with Python_, in either direction … Right ? | yes, that is accurate. |
Will there be an example of using the matplotlib lib via Delphi in the second webinar? | Yes |
I am registered in part1, i should to registered in part2 o this is automatic, for the session 2 | Already registered. |
Good session! Thank you! 🙂 | Agreed, welcome. |
is there a reference document please? | There is some documentation here, with 33 demos, and this webinar |
If it possible to select particular virtual environment created by conda? | yes |
Is it possible to return from a delphi function a STRING to the python output ? | yes |
Thank you, very interesting. | |
Can I access matplotlib? If so how, in separate windows, or embedded in a GUI e.g. inside VCL | Join us in 2 weeks |
Very good stuff! | agreed |
Will we be able to watch this webinar again later or share it with a colleague? | yes |
Can you pass a Python list into Delphi? | of course. |
Great webinar! It opened up of ideas to integrate Python and Delphi in my projects. Looking forward to the next webinar. | yes |
Can i access database objects like the clientdataset from python? | yes |
Last I worked on Delphi was in 1995. P4D is a good reason to return to Delphi! | yes |
Thank you! | |
hello, is d4p fully cross platform ? | yes, but no Python on mobile yet.,yes, but no Python on mobile yet. |
Can I use Sublime Text? | sure |
Awesome! | |
Thanks for sharing/showing. | |
is there any class documentation or reference please? | use the source |
Awesome intro. Looking forward to the next sessions. Kudos to Embarcadero to arrange this webinar. | Thanks! |
Jim and Kiriakos: Just to clarify for the audience … “Python4Delphi” is _not_ a cross-compiler of Python for Delphi … Instead, this project is definitely designed for the _simultaneous coexistence of Delphi with Python_, in either direction … Right ? | correct |
Very interesting. (I used PascalScript from RemObjects in my application). | |
Good Session! | |
Is there any training about Python4Delphi available ? | not yet, but I am working on it. |
does it work on mobile OS? Android & IOS? | Python doesn’t work on mobile. |
when is second webinar? | two weeks. |
Is it planned to publish the Python4Delphi via GetIt Package Manager to simplify the installation? | Yes. |
Can i access database objects like the clientdataset from python? | yes |
How can delphi be used from python in other way than delphi project/module compiled into dll? | yes, next session in two weeks. |
Great! How I can ditribute Python packages with Python dll? | Consult the Python docs. |
How many attendees are here, Jim? | A lot. |
Worked on Chrome on mac | |
Good stuff! | |
would it be same webinar link for part 2? Or I need to search for new link? | yes |
Thankyou:) | |
does reference counting management have to be manual? can future versions of the library automate this? | The preferred options do automatic reference counting. |
is there need a python.dll when running exe file? | yes |
How much will it cost? | free / open source |
Is it possible to transfer bitmaps, generated by Python, back to Delphi? I’m thinking about svg->bmp conversions etc. | In theory |
Thank you for answer! | |
Applause from one of the audience. You both doing a good job! | |
Will P4D compile in Delphi community? | yes |
Very Cool. Excellent seminar. Thanks for putting this on. | |
Loved it! Opens so many opportunities! Thank you! | |
Is it fully compatible with RAD Server code running on Linux Ubuntu? | yes,yes |
Great webinar! Thank you! | |
have been playing with this on and off for a few years. Can we have a simple example of handing an array off to python, processing in numpy and handing back to delphi | yes, will work on that. |
Cool! Looking forward to the next session! Please stay safe and healthy everybody. | thanks |
can it run on Android and IOS? | not yet |
So much great stuff to cover – you need a part 3 – people want more 😀 | |
How many developers are contributing to this project ? This is a must for any “modern age” Delphi developer !!! ?? | |
great work, thanks for this session, see you in the next one! | |
Excellent webinar. Very exciting. Looking forward to part 2. Excatly what we were looking for. | |
Excellent stuff! I definitely intend to use P4D. Thanks and regards from Israel | |
is Python4Delphi support with multidevice (FMX) ? | yes, macOS, Linux, and Windows. No Python on mobile yet. |
Look forward to seeing it in Get It Package Manager in near future. | Will work on it. |
I use python on AWS. Can I use Delphi Object there? | if you deploy it there then yes. Just deploy a linux module. |
Awesome demo. I look forward to learning more. | |
Yes, more time on Python libraries please!!! 🙂 | will do |
15 years of delphi usage, 10 years of python usage… Thanks for your job!!! | |
does reference counting management have to be manual? can future versions of the p4d library automate this? | When you use the high level wrapper components it does handle reference counting automatic. |
What do you mean by Python functions being accessed in low-level code from Dephi ? | Delphi can call the Python functions directly. |
What can you say that what major advantages of using P4D versus developing pure python machine learning projects? | Use Delphi for UI or other integrations |
How can we help; do you like Pull Requests? Or first discuss proposals? | How ever you want to get involved is great! |
I have done loads of things with Delphi on windows and linux in AWS | Ah, great! |
Do you think you replaced Tkinter? please say yes 😉 | That is certainly one usage senario. |
Exactly what I wanted to propose! | |
When i compile demo01, its show an error could not open DLL “python32.dll”, i cant find the dll in source code, how to fix it? | You need to install Python first, and make sure the bitness of Python matches the bitness of your application (32 vs 64 bit) you can install both. |
After the success of Bold community launch, might it be worth organising a Discord channel? or is there similar already? | Certainly something to look at. |
Can I handle delphi errors from python? | yes |
if you have high level components, why would you need low level ones? | The high level components use RTTI so the low level components give you a little more control and allow you to remove the RTTI overhead. |
Please list the high level classes and the low level classes, I’m unsure which are which. | TPyDelphiWrapper is the high level component. |
I need to go on! Thank´s Folks! See you later! | |
Can I debug Python Code from Delphi? | You can;t debug Python code from the Delphi IDE, but you could use PyScripter to debug the code. Your Delphi application |
Can we create a sample module designed in Delphi and install with PIP? | |
I am trying to compile the package for Delphi 10.4, but he unit PythonAction has a lot of bug because of wrong using Ansi and Unicode strings… is it in progress? | |
Is it possible to share memory between Delphi and Python | |
Very interesting, thank you. Looking forward to 2nd | |
really great information, thank you very much! see you next time | |
Will python test automation be covered next time? | |
when Java at Delphi? | |
Thanks! | |
Thank you ! Great job ! | |
Thank you guys, very much appreciated!!! | |
Thank you! | |
Really useful | |
thx | |
Thank you 🙂 | |
Thanks VERY much! | |
Gracias a ustedes. Esperamos ansioso la segunda parte | |
thanks |