简体   繁体   中英

How to stop gnuplot window poping-up when using it from command line in windows?

I am using perl to open a pipe to pgnuplot.exe to output plot commands. For example,

open ($PLOT, "|pgnuplot") or die "error: gnuplot not found!";

print $PLOT <<EOPLOT;

set term postscript eps enhanced "Arial" 20
set output "somefile.eps"

## do some plotting here ##

EOPLOT

close $PLOT;

I notice that a window for gnuplot always pops up and grabs the focus of my mouse and keyboard momentarily. This makes it difficult to use the computer while the plot script is running.

Is there any way to stop pgnuplot from opening a window?

Yes, when starting a program in Windows ( CreateProcess API) it is possible to request that the main window be hidden or minimized without focus (among other options). But I don't know whether perl provides a easy way to do that.

You might consider using batch operation instead (put your plot commands in a file, then pass the filename to gnuplot).

You can prevent showing child console windows via Win32 module:

use Win32;
Win32::SetChildShowWindow(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM