Welcome, Guest
Username: Password: Remember me
Components and Libraries for Scripting Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Python 9 years 10 months ago #5577

  • evgeniy
  • evgeniy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 1
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.

Python 9 years 10 months ago #5578

  • fredvs
  • fredvs's Avatar
  • Visitor
  • Visitor
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)

;)

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

Last edit: by fredvs.
  • Page:
  • 1