Skip to content

OnSendUniData event does not work #463

Description

@Uefi1

Hello, the OnSendUniData event assigned to TPythonGUIInputOutput is not WORK.

type
TRcv = class
procedure PythonInputOutputSendUniData(Sender: TObject; const Data: string);
end;

var
PythonEngine: TPythonEngine;
PythonInputOutput:TPythonGUIInputOutput;
Rcv:TRcv;
Temp:string;

{ TRcv }

procedure TRcv.PythonInputOutputSendUniData(Sender: TObject; const Data: string);
begin
Temp:='Event triggered'; //
end;

function execpythonscript(const Filename:string):string;
begin
 Result:='';
  PythonEngine := TPythonEngine.Create(nil);
    PythonInputOutput:=TPythonGUIInputOutput.Create(nil);
    PythonInputOutput.OnSendUniData:=Rcv.PythonInputOutputSendUniData;
    PythonInputOutput.UnicodeIO:=True;
    PythonInputOutput.DelayWrites:=True;
    PythonEngine.IO:=PythonInputOutput;
    PythonEngine.InitThreads := True;
    PythonEngine.UseLastKnownVersion := True
    PythonEngine.AutoLoad := False;
    PythonEngine.AutoUnload := False;
    PythonEngine.AutoFinalize := True;
    PythonEngine.RedirectIO := True;
    PythonEngine.LoadDll;
    TPythonThread.Py_Begin_Allow_Threads;
FGILState := PythonEngine.PyGILState_Ensure;
try
PythonEngine.ExecFile(Filename);
except
end;
PythonEngine.PyGILState_Release(FGILState);
Result:=Temp; //Always empty
end;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions