[Scilab-users] How to print GUI window?

Samuel Gougeon sgougeon at free.fr
Fri Aug 2 00:09:16 CEST 2019


Le 01/08/2019 à 23:40, VTX1801 a écrit :
> Copied your test code to new Scilab program.
> Ran the code.
> Graphic window appears with plot graph and uicontrol text object at the
> bottom with the word Test.
> Photos.test window appears with only the plot graph.
> The uicontrol is missing.
>
> Is the plot graph the graphic that is exported?
> Do you need to assign the whole figure to export?

Here is another version of the code, to capture only the graphical area, 
without the window borders:

// Generate a GUI (from demos)
exec("SCI/modules/gui/demos/uicontrol_plot3d.dem.sce",-1);

f  =  findobj("figure_id",100001);
f.visible  =  "on";                    // Brings the GUI window on the front
fs  =  f.figure_size;
as  =  f.axes_size;
border_width  =  (fs(1)-as(1))/2;
header_height  =  fs(2)-as(2)-border_width;
// Hiding the left border and header of the window out of screen
f.figure_position([1  2])  =  [-border_width  -header_height];

filename  =  "capture_$U(Y-%m-%d %H%M%S).png";  // with a timestamp in the file name
filename  =  "capture.png";                     // simple fixed file name
iview_path  =  findfileassociation(".png");     // or replace with the fixed known path
                                              // to IrfanView on your computer
cmd  =  "%s /capture=7=(0,0,%d,%d) /convert=%s";
cmd  =  msprintf(cmd,  iview_path,  as(1),  as(2),  filename);
status  =  host(cmd);
winopen(filename);

Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190802/74a8feb4/attachment.htm>


More information about the users mailing list