[Scilab-users] How to print GUI window?

Samuel Gougeon sgougeon at free.fr
Thu Aug 1 21:50:02 CEST 2019


Le 01/08/2019 à 20:34, VTX1801 a écrit :
> Hello,
> Further test with a simple plot figure does print correctly.
> So this issue is somehow related to a larger window GUI with multiple
> objects including a plot.

There are potentially 2 issues :

 1. your GUI is not dockable. The java error message you get is about that.
 2. Even with a dockable GUI, AFAIK and as you can check the export
    fails as soon as there is a uicontrol component in the exported
    figure : it yields to a white image.

So, for the time being, it looks hard to not use an external software to 
export the GUI as an image.
Fortunately, softwares can be called from Scilab.
You will find here-below some code to be run on Windows (it's your OS, 
according to your report).
It uses the famous IrfanView free software.
This code works perfectly for me. It should be easily adaptable to your 
case.

Best regards.
Samuel


// Generate a GUI (from 
demos)exec("SCI/modules/gui/demos/uicontrol_plot3d.dem.sce",-1);f=findobj("figure_id",100001);f.figure_position([12])=[00];// 
Imposes the GUI position on the screenf.visible="on";// Brings the GUI 
window on the fronts=f.figure_size;filename="capture_$U(Y-%m-%d 
%H%M%S).png";// with a timestamp in the file 
namefilename="capture.png";// simple fixed file 
nameiview_path=findfileassociation(".png");// or replace with the fixed 
known path// to IrfanView .exe on your computercmd="%s 
/capture=7=(0,0,%d,%d) 
/convert=%s";cmd=msprintf(cmd,iview_path,s(1),s(2),filename);status=host(cmd);winopen(filename);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190801/36d316b4/attachment.htm>


More information about the users mailing list