|
From: Daniel J S. <dan...@ie...> - 2018-08-17 21:07:10
|
On 08/17/2018 03:15 PM, Dima Kogan wrote: > Hi. > > I'm looking for a feature that (I think) doesn't exist currently. Want > to ask first, in case something DOES exist that I'm not seeing. > > A number of applications that make plots use gnuplot as a backend. The > sequence you want there is: > > 1. User says "make a plot" > > 2. Application tells gnuplot to make a plot > > 3. gnuplot does its thing using an interactive terminal (x11, qt, wxt, > ...) and a plot window pops up > > 4. user looks at the plot, then closes the window when they're done, and > wants to continue using the application > > The issue here is that currently the application (parent of the > "gnuplot" process) has no way of knowing when the user finished looking > at the plot, which necessitates ugly workarounds. For instance with > gnuplotlib I can write a script that just makes a plot. If I just call > gnuplotlib.plot(), then the application will make a plot and then exit > immediately. As a workaround I put a sleep(10000) after the plot() call. > I'd like to have some sort of gnuplotlib.wait() that blocks until > gnuplot is done. Maybe gnuplot can be asked to print something on the > console when the client window is closed, or something? Thoughts? Does "gnuplot --persist" work for your needs? In the following, the gnuplot_qt process hangs around until the window is closed: @linux ~ $ gnuplot --persist G N U P L O T Version 5.3 patchlevel 0 last modified 2018-04-26 Copyright (C) 1986-1993, 1998, 2004, 2007-2018 Thomas Williams, Colin Kelley and many others gnuplot home: http://www.gnuplot.info mailing list: gnu...@li... faq, bugs, etc: type "help FAQ" immediate help: type "help" (plot window: hit 'h') Terminal type is now 'qt' Options are '0 font "Sans,9"' gnuplot> system "ps -e | grep gnuplot" 6680 pts/1 00:00:00 gnuplot gnuplot> plot 1/x gnuplot> system "ps -e | grep gnuplot" 6680 pts/1 00:00:00 gnuplot 6690 ? 00:00:00 gnuplot_qt gnuplot> exit @linux ~ $ ps -e | grep gnuplot 6690 ? 00:00:00 gnuplot_qt @linux ~ $ (manually close window) manually: command not found @linux ~ $ ps -e | grep gnuplot @linux ~ $ |