Recent

Author Topic: Installation of Python4Delphi  (Read 10165 times)

docwat

  • New Member
  • *
  • Posts: 40
Installation of Python4Delphi
« on: August 27, 2018, 12:51:44 pm »
Hi,

I am trying to install python4delphi into Lazarus. The download .zip is full of .dpg rather than .lpg files and a number of .pas files.  I have no experience of porting Delphi packages.

If anyone could point me to the starting line that would be great !

Many thanks,

Docwat

soerensen3

  • Full Member
  • ***
  • Posts: 213
Re: Installation of Python4Delphi
« Reply #1 on: August 27, 2018, 01:37:55 pm »
Have you tried this: https://github.com/Alexey-T/Python-for-Lazarus/tree/master/python4lazarus
I think there is even a version available in Online Package Manager
Did you use google? There is even a wiki page: http://wiki.freepascal.org/Using_Python_in_Lazarus_on_Windows/Linux
Lazarus 1.9 with FPC 3.0.4
Target: Manjaro Linux 64 Bit (4.9.68-1-MANJARO)

docwat

  • New Member
  • *
  • Posts: 40
Re: Installation of Python4Delphi
« Reply #2 on: August 27, 2018, 02:17:41 pm »
Many thank Soersen3,   I will recheck these resources.  So far I have not found a detailed route to installing the python4delphi package. I must be missing something very simple.

Thanks,

Docwat

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Installation of Python4Delphi
« Reply #3 on: August 27, 2018, 02:22:59 pm »
Many thank Soersen3,   I will recheck these resources.  So far I have not found a detailed route to installing the python4delphi package. I must be missing something very simple.

Thanks,

Docwat
Yes, the simple thing is you can't install delphi packages in Lazarus, because the format differs. Python4Lazarus is a straight port, though, so use that.
The author is on this forum.
Specialize a type, not a var.

docwat

  • New Member
  • *
  • Posts: 40
Re: Installation of Python4Delphi
« Reply #4 on: August 27, 2018, 02:43:48 pm »
Hi both Soersen and Thappy,

Very many thanks - I was unaware that there was a python4lazarus - That explains my problem

much appreciated,

Docwat

docwat

  • New Member
  • *
  • Posts: 40
Re: Installation of Python4Delphi
« Reply #5 on: August 31, 2018, 02:45:15 pm »
Whilst Python4Lazarus installs, I am having difficulty running the simple test prog below.  The program accepts an input script print(2+2)  however the PythonGUIInputOutput module simple clears the TREDIT  output Tmemo.  This suggests that the PythonEngine1 is outputting something to the PGIO which overrides the TREDIT with nulls. Additionally if the input script is miss-entered as print(2+A) the unit ends with the expected exception.

My windows system is 8.1 32bit and Python version 3.7. With the PythonEngine correctly showing script errors and the PythonGUIInputOutput resopnding, can it be that Python3.7 does not work in this environment ?

I would be grateful for any comments.

Thanks  Docwat


unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, SynHighlighterPython, Forms, Controls, Graphics,
  Dialogs, StdCtrls, PythonGUIInputOutput, PythonEngine;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    TREDIT: TMemo;
    PythonEngine1: TPythonEngine;
    PythonGUIInputOutput1: TPythonGUIInputOutput;
    procedure Button1Click(Sender: TObject);

  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
  PythonEngine1.ExecStrings(Memo1.Lines);
end;


end.           

docwat

  • New Member
  • *
  • Posts: 40
Re: Installation of Python4Delphi
« Reply #6 on: August 31, 2018, 03:38:42 pm »
I find it P4L was responding next line down in TMemo which was off my component height !

Working fine !

DocWat

AlexTP

  • Hero Member
  • *****
  • Posts: 2384
    • UVviewsoft
Re: Installation of Python4Delphi
« Reply #7 on: February 16, 2019, 12:18:26 pm »
Python4Lazarus has Lazarus demo app (Edit+Memo), check it.

 

TinyPortal © 2005-2018