pier
-
Content Count
3 -
Joined
-
Last visited
Posts posted by pier
-
-
Thank you so much for your reply. I was aware of the possibility of using the SVG output of matplotlib (which I will use as an intermediate solution), however this is not what I am looking for. matplotlib was just an example of a more general type of approach I am pursuing, i.e. "embedding"/"controlling" graphical output of python applications in order to make it appear more integrated within a Delphi application. Anyhow thank you again for your time and suggestion.
-
Hi!
Do you believe it is feasible to show some python graphics, say from matplotlib, and the "hook" the window and make it "live" inside a panel of a Delphi application? (when the panel moves/resizes the window moves/resizes with it)? If so is any code for doing this available? (if not I will write it)
Thanks for any suggestion
Window hooking
in Python4Delphi
Posted
In case somebody is interested this is how I managed to nicely integrate matplotlib figures inside my delphi app.
1) the pythons script shows the plot with "plt.show(block=False)"
2) this is the code which executes the script and embeds the plot
procedure TForm1.Button1Click(Sender: TObject);
var plotwnd:HWND;
begin
PythonEngine1.ExecStrings( Synedit1.Lines );
plotwnd:=Findwindow(nil,'Figure 1');
if plotwnd<>0 then
begin
Windows.SetParent(plotwnd,(PageControl1.Pages[1] as TTabSheet).Handle);
SetWindowLong(plotwnd, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and not WS_BORDER and not WS_SIZEBOX and not WS_DLGFRAME );
showwindow(plotwnd,sw_showmaximized);
setforegroundwindow(plotwnd);
end;
end;
the plot is displayed inside a tabsheet which has an event handler to automatically resize the plot
procedure TForm1.PlotResize(Sender: TObject);
begin
movewindow(plotwnd,0,0,(PageControl1.Pages[1] as TTabSheet).Width,(PageControl1.Pages[1] as TTabSheet).Height,True);
end;