Jump to content

Recommended Posts

Posted (edited)

Good day everyone!

I have a question. Perhaps someone has already experienced this.
I have a ready-made program on Delphi. And I need to initialize and execute all the functions of this program using a Python script. Is it possible to accomplish this task only with the help of TPytnon components? Without adding memos and other things as shown in the demo programs.

Just run the script and get the result.

Maybe someone can help with this question. I would be very grateful for any help.

Thanks for attention.

Edited by Albion

Share this post


Link to post

There is no way for Python to know about the objects/functions in your delphi program. You have to create some classes and register them with the Delphi4Python to expose them to the python side.

These can be your real classes in your application (not advised IMHO), or "bridge" classes that just expose functions to python. Then, in your implementation of the bridge methods, you call methods/functions on the delphi side.

  • Thanks 1

Share this post


Link to post
On 27.03.2022 at 22:31, Dave Novo said:

У Python нет возможности узнать об объектах/функциях в вашей программе Delphi. Вам нужно создать несколько классов и зарегистрировать их в Delphi4Python, чтобы предоставить их стороне Python.

Это могут быть ваши настоящие классы в вашем приложении (не рекомендуется ИМХО) или классы-«мосты», которые просто предоставляют функции для python. Затем в вашей реализации методов моста вы вызываете методы/функции на стороне delphi.

Hello, thanks for your help. I also wanted to clarify whether it is possible to initialize Delphi procedures.
For example, I have a Button1.click procedure, is it possible to initialize and run it using a Python script?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×