freelanceprogrammers.org Forum Index » Delphi
Is this possible that both Py and Delphi are free to talk to
Joined: 15 Aug 2006
Posts: 7
Is this possible that both Py and Delphi are free to talk to
I`m trying to write a little python program with Delphi as its GUI.
The application will have a python thread running in the backgroud and
notify the GUI whenever nessessary.Then the Delphi part(GUI) displays
a notice box on the screen upon the notifying.
However, the GUI will also has a main form which is responsible of
manage the context(many pythong lists,dicts...) in which the python
thread is running.
So basically, both python and delphi will be an action initiator, or,
they should both be able to talk to the other part freely.
As my understanding, p4d only helps Delphi talks to python scripts,
but not the converse. Am I right? And any ideas on how I can get what
I want?
Thanks
Andy
Joined: 01 May 2005
Posts: 7
Is this possible that both Py and Delphi are free to talk to
Hi Andy
The limitation you`re worried about is not the case. P4D allows a
Python script to invoke Delphi code and interact with Delphi objects,
variables and so on in remarkably complex ways!
I use P4D in a complex engineering application, where Python is used
for the top-level `business logic`, controlling sequences of tests.
The beauty part is that a simple, elegant Python statement can invoke
a load of gritty low-level Delphi code. For example, in Python
`value=measure.getVoltage()` calls a Delphi method in my module
`measure`, which does some thread based serial comms and returns a
value to the Python script.
My stuff generally runs in real-time for long periods of time. I use
a lot of P4D Python Variables as semaphores, for signalling between
the Delphi UI and Python script.
I`d recommend you try out P4D, run the examples, play around and see
what`s possible. Hopefully you will be amazed by the power and
possibilities :-)
Hope this helps.
Regards,
Rich
--- In pythonfordelphi@yahoogroups.com, "ice.tortoise"
<ice.tortoise@...> wrote:
>
> I`m trying to write a little python program with Delphi as its GUI.
> The application will have a python thread running in the backgroud and
> notify the GUI whenever nessessary.Then the Delphi part(GUI) displays
> a notice box on the screen upon the notifying.
>
> However, the GUI will also has a main form which is responsible of
> manage the context(many pythong lists,dicts...) in which the python
> thread is running.
>
> So basically, both python and delphi will be an action initiator, or,
> they should both be able to talk to the other part freely.
>
> As my understanding, p4d only helps Delphi talks to python scripts,
> but not the converse. Am I right? And any ideas on how I can get what
> I want?
>
> Thanks
>
> Andy
>
Joined: 29 Apr 2005
Posts: 103
Is this possible that both Py and Delphi are free to talk to
Hi,
P4D can help in both ways. You can easily
“talk” to Python from Delphi using
the VarPyth unit which wraps Python objects into custom variants.
Also, you can have access to Delphi objects from Python using the PyDelphiWrapper component
that wraps common components (and common properties/methods).
However, if you need a background thread
in Python, your life might become much more complex…
You can have a look at the wiki (http://py4d.pbwiki.com/) that was started by
a couple of P4D users and explore the advanced section where they shared their
experience of Python threading and Delphi…
Note that if you don’t have the
skills, then you might be in trouble as you won’t get much assistance on
this subject.
Bye,
Morgan
From: pythonfordelphi@yahoogroups.com [mailto:pythonfordelphi@yahoogroups.com] On Behalf Of ice.tortoise
Sent: Monday, August 14, 2006
11:44 PM
To: pythonfordelphi@yahoogroups.com
Subject: [pythonfordelphi] Is this
possible that both Py and Delphi are free to
talk to each other?
I`m trying to write a little python program with Delphi as its GUI.
The application will have a python thread running in the backgroud and
notify the GUI whenever nessessary.Then the Delphi
part(GUI) displays
a notice box on the screen upon the notifying.
However, the GUI will also has a main form which is responsible of
manage the context(many pythong lists,dicts...) in which the python
thread is running.
So basically, both python and delphi will be an action initiator, or,
they should both be able to talk to the other part freely.
As my understanding, p4d only helps Delphi
talks to python scripts,
but not the converse. Am I right? And any ideas on how I can get what
I want?
Thanks
Andy
Joined: 15 Aug 2006
Posts: 7
Is this possible that both Py and Delphi are free to talk to
Thanks for sharing Rich.
I went through the tutorial and got the impression that P4D only makes
delphi being able to invoke python scripts. It seems I missed something...
Is there a demo/example using python as the main working thread and it
calls to different delphi GUI components when it is nessesary?
I gave up wxPython as soon as I found P4D as my program only runs on
windows system. And I was going to use ctypes to make my python
scripts invoking a delphi dll which has my GUI components, but now it
seems all I need is P4D. It has already amazed me.
Andy
--- In pythonfordelphi@yahoogroups.com, "richardandersonwright"
<rich@...> wrote:
>
> Hi Andy
>
> The limitation you`re worried about is not the case. P4D allows a
> Python script to invoke Delphi code and interact with Delphi objects,
> variables and so on in remarkably complex ways!
> I use P4D in a complex engineering application, where Python is used
> for the top-level `business logic`, controlling sequences of tests.
> The beauty part is that a simple, elegant Python statement can invoke
> a load of gritty low-level Delphi code. For example, in Python
> `value=measure.getVoltage()` calls a Delphi method in my module
> `measure`, which does some thread based serial comms and returns a
> value to the Python script.
> My stuff generally runs in real-time for long periods of time. I use
> a lot of P4D Python Variables as semaphores, for signalling between
> the Delphi UI and Python script.
> I`d recommend you try out P4D, run the examples, play around and see
> what`s possible. Hopefully you will be amazed by the power and
> possibilities :-)
>
> Hope this helps.
>
> Regards,
> Rich
>
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







