× Components and Libraries for Scripting Development, discussions, problems and suggestions

Question Python

  • evgeniy
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
6 years 1 month ago #5577 by evgeniy
Python was created by evgeniy
It's worked project code.google.com/p/python4delphi/
...
implementation
uses PythonEngine;

procedure TForm1.Button2Click(Sender: TObject);
var
  py:TPythonEngine;
  p:PPyObject;
  s:TStringList;
begin
  py := TPythonEngine.Create(nil);
  s:=TStringList.Create;
  try
    s.Add('class t1(object):');
    s.Add('  def test(self):');
    s.Add('    return 1');
    s.Add('t=t1()');
    py.InitScript.Text:=s.Text;
    py.Initialize;
    Memo1.Lines.Add(py.EvalStringAsStr('"test"'));
    Memo1.Lines.Add(py.EvalStringAsStr('t.test()'));
  finally
    py.Free;
    s.Free;
  end;
end;
...

Please Log in or Create an account to join the conversation.

  • fredvs
  • Visitor
  • Visitor
6 years 1 month ago - 6 years 1 month ago #5578 by fredvs
Replied by fredvs on topic Python
Yep it works but it seams to me that using a fpc native library it is working even better...

The idea is to create a fpc native library, with all your complicated pascal code and load it from a Python application.

What great with Python is that you do not need wrapper for the library.

Here some fpc native libraries used by Python applications :

=> github.com/fredvs/fpGUIlib
(see in .../demos/demo_python)

or here
=> github.com/fredvs/uoslib
(see in .../examples /demos /python)

;)
Last edit: 6 years 1 month ago by fredvs.

Please Log in or Create an account to join the conversation.