|
From: <nas...@la...> - 2010-05-21 09:09:15
|
Hello, I am using gnuplot to display measurment data directly out of my self-written console-program. So far this works great but the problem is, that after gnuplot was called by my program, and the terminal with the plot is shown (wxt), the user has to type "quit" in console to exit gnuplot and return to my program. My question now is, if it is possible to automatically quit gnuplot when the terminal window is closed by the user. Thx 4 help & GreetZ, Dirk |
|
From: <nas...@la...> - 2010-05-21 09:01:36
|
Hello, I am using gnuplot to display measurment data directly out of my self-written console-program. So far this works great but the problem is, that after gnuplot was called by my program, and the terminal with the plot is shown (wxt), the user has to type "quit" in console to exit gnuplot and return to my program. My question now is, if it is possible to automatically quit gnuplot when the terminal window is closed by the user. Thx 4 help & GreetZ |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2010-05-21 18:53:34
|
nas...@la... wrote: > I am using gnuplot to display measurment data directly out of my > self-written console-program. So far this works great but the problem is, > that after gnuplot was called by my program, and the terminal with the > plot is shown (wxt), the user has to type "quit" in console to exit > gnuplot and return to my program. My question now is, if it is possible to > automatically quit gnuplot when the terminal window is closed by the user. You appear to be searching for the --persist option. |
|
From: <nas...@la...> - 2010-05-24 07:08:15
|
> nas...@la... wrote: >> I am using gnuplot to display measurment data directly out of my >> self-written console-program. So far this works great but the problem >> is, >> that after gnuplot was called by my program, and the terminal with the >> plot is shown (wxt), the user has to type "quit" in console to exit >> gnuplot and return to my program. My question now is, if it is possible >> to >> automatically quit gnuplot when the terminal window is closed by the >> user. > > You appear to be searching for the --persist option. > > No, I am already using this param. But it only has the effect that the plot window doesn't close immediately. But the disadvantage of it is (as described above) that you have to type "quit" to the console to exit gnuplot. What I need is that gnuplot closes automatically when the plot window is closed. For better understanding I have tried to illustrate what I mean here: http://img714.imageshack.us/img714/5448/gnuplotdesc.jpg |
|
From: Tatsuro M. <tma...@ya...> - 2010-05-24 08:20:32
|
Hello --- nastydirk wrote: > > nas...@la... wrote: > >> I am using gnuplot to display measurment data directly out of my > >> self-written console-program. So far this works great but the problem > >> is, > >> that after gnuplot was called by my program, and the terminal with the > >> plot is shown (wxt), the user has to type "quit" in console to exit > >> gnuplot and return to my program. My question now is, if it is possible > >> to > >> automatically quit gnuplot when the terminal window is closed by the > >> user. > > > > You appear to be searching for the --persist option. > > > > > > No, I am already using this param. But it only has the effect that the > plot window doesn't close immediately. But the disadvantage of it is (as > described above) that you have to type "quit" to the console to exit > gnuplot. What I need is that gnuplot closes automatically when the plot > window is closed. > > For better understanding I have tried to illustrate what I mean here: > http://img714.imageshack.us/img714/5448/gnuplotdesc.jpg > For windows binary persist option works a little bit different way from that in unixy case. (I have tested in the cygwin gnuplot+X11) For unixy case gnuplot -persist -e "plot sin(x)" The gnuplot finished persisting the plot. (However, no key and mouse operations on plot window are active because the gnuplot interactive session is closed.) For windows case gnuplot -persist -e "plot sin(x)" The gnuplot does not finished with the prompt 'gnuplot>'. To my knowledge, at this moment, it is not possible to realize what you want to do. Regards Tatsuro -------------------------------------- 2010 FIFA World Cup News [Yahoo!Sports/sportsnavi] http://pr.mail.yahoo.co.jp/southafrica2010/ |
|
From: pjhoust <hou...@ro...> - 2017-06-23 16:23:39
|
GIven: RHEL/CENTOS 6 with utilities xwininfo and xev
The following worked for me to create a window destruction notification
function within the script that I used to call gnuplot. Call the function
with the name of your gnuplot graph window (yes, you have to name it and
make sure it's unique) and a process ID (usually that of the shell running
gnuplot) and background it. When it detects that the given window has been
destroyed, it exits sending a SIGUSR1 signal to whatever PID you gave it.
What you do with the signal is up to you but I just do a mass murder.
###############################################################################
#
# NAME
# WinDestroyNotify
#
# SYNOPSIS
# WinDestroyNotify WIN_NAME PID
#
# DESCRIPTION
# Waits for X window given by WIN_NAME to be destroyed then sends
# SIGUSR1 to process given by PID
#
###############################################################################
WinDestroyNotify() {
local WIN_NAME=$1
local NOTIFY_PID=$2
local FIFO="/tmp/WinDestroyNotify.$$.fifo"
local winid_regex=".*id: ([^ ]*) .*"
local WIN_ID=
local LOOP_PID=
local XEV_PID=
[[ "$(xwininfo -name "$WIN_NAME" )" =~ ${winid_regex} ]] &&
WIN_ID=${BASH_REMATCH[1]}
mkfifo $FIFO >/dev/null 2>&1
while read line
do
[[ $line =~ Destroy ]] && exit
done <$FIFO &
LOOP_PID=$!
xev -id $WIN_ID > $FIFO &
XEV_PID=$!
wait $LOOP_PID
kill $XEV_PID >/dev/null 2>&1
rm -f $FIFO >/dev/null 2>&1
kill -USR1 $NOTIFY_PID >/dev/null 2>&1
}
--
View this message in context: http://gnuplot.10905.n7.nabble.com/Quit-gnuplot-when-plot-window-is-closed-tp1633p20695.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|