The next tutorial builds on the basic wxploop commands introduced in this tutorial, but concentrates on getting multiple plots as overlays, and in creating loops for animation.
Before starting this tutorial, there are a few things to know. You will need to know where the data is stored at your site, and how to set your UDRESPATH environment variable. It would help to be familiar with the resources that are held in the site Wxp.res file, and in how to use the WXP Interactive Shell. Knowledge of using WXP programs from the command line will be required. These points are covered in previous tutorials:
To get the most out of this tutorial, please have your user's manual on hand so that you can refer to the manual pages. As new options are introduced, we will refer to the manual pages for explanations. This process will show how information can be retrieved from the manual.
Notation: In the text below, the percent sign % refers to the system prompt. You will see a similar prompt in your working window. You should type any text following the % sign at your system prompt; you then hit return on the keyboard to enter the command. Text on the lines immediately following will show the expected response to your action. Where the next line starts with the % sign in the text below, type that line at your system prompt.
If we start wxploop, we will create a wxploop process on our workstation. No window will be displayed at this time. The following command will start a wxploop process and background it using the & sign:
% wxploop &
[1] 22401
WXP LOOP PROGRAM (VERSION:2.4-4.6-X11)
and hit return
%The return gets the unix prompt back. An error message may occur on invoking wxploop:
% wxploop & Unable to create message queue Either another wxploop program is using this queue or it has not been deleted (use "ipcrm -q 601")This means that another wxploop process is using the same window number We'll discuss window numbers later. To remove the queue and thus be able to invoke wxploop, follow the instruction from the error message:
% ipcrm -q 601The number 601 is specific to the previous wxploop process. This number changes with each invocation of wxploop. If you had to perform this command, go ahead now and invoke a wxploop process by typing:
% wxploop &
[1] 22416
WXP LOOP PROGRAM (VERSION:2.4-4.6-X11)
Now, how do we get a window to appear associated with wxploop? The above
command created a wxploop process with process ID 22416. You can also use
the following command to find the process ID:
% ps -guax | grep wxploopwhich returns:
user 22416 0.0 0.9 296 872 q3 S 14:24 0:00 wxploop user 22441 0.0 0.3 40 240 q3 S 14:25 0:00 grep wxploopThe process ID for the wxploop program above is 22416. Note that the grep command also has a process ID. It is useful to know about the ID because occasionally, wxploop processes get hung up and need to be deleted. To remove the process, type:
% kill 22416which returns:
[1] Done wxploopand then type:
% ps -guax | grep wxploop user 22557 0.0 0.3 40 256 q3 S 14:29 0:00 grep wxploopSo, to start a wxploop again, type:
% wxploop &
[1] 22588
WXP LOOP PROGRAM (VERSION:2.4-4.6-X11)
(hit return)
%
The wxploop process has a window number associated with it, 0 in
this case by default. Window numbers will become clearer in a moment so
bear with us. If we now type the command:
% loopset opena window pops up on the screen with the title wxploop. This happens because when wxploop started up, it created a message queue to window 0 (the default window). The program loopset uses this message queue to pass commands to the wxploop process running window 0. The command open is a wxploop command that loopset sends to wxploop. A list of commands can be found in the wxploop program pages of the Program Reference.
To get a short listing of available commands, type the following:
% loopset
WXPLOOP PARAMETER SETTING PROGRAM (VERSION:1.2-4.6-X11)
Message queue opened (id:1103)
Connected to WXPloop program
Type help for help
Message:1:
We enter help at the Message:1: prompt
Message:1: helpand the following listing of commands is displayed:
Help for wxploop program parameter setting
Keywords Remarks
-------- -------
status check wxploop status
list {type} list out current pixmap info
loop start/stop looping
step step through images
next step through images
for step forward to next image
back step backward to next image
goto {image} go to a specific image
set re {region} specify region parameter
set dir for specify forward increment loop
set dir back specify backward increment loop
set delay {time} specify loop delay time
set pause {time} specify end of loop delay time
ti ba {ti} specify base image title
ti ov {num} {ti} specify overlay num image title
ti {num} {ti} title an image num as title
que {spec} inquires current loop specifications
add {file} add a pixmap file to the loop
add {file} {ti} add a pixmap file with title specified
cr {pix} add a new pixmap to end of loop
in {num} {pix} insert a new pixmap into loop
ld {num} {file} {ti} load a pixmap file on existing pixmap
over {num} {file} overlay a pixmap file on existing pixmap
del {image} delete a specific image number
help display this help screen
quit exit loopset
exit exit loopset
kill terminate wxploop program
This list is a small section of the total wxploop commands shown in
the wxploop section of the WXP program reference.To get rid of the window and kill the wxploop process, we type:
% loopset killwhich returns:
WXPloop stopped!! [1] Done wxploop %The process is stopped, and the window disappears. We can use the abrieviation k for kill. Backgrounding the process is slow, so we can set up wxploop to automatically background by using the batch option. Type the following commands:
% wxploop -batch % loopset open This_WindowIn this case, the unix prompt comes back after wxploop and the window opened by loopset now has the name This_Window. The underscore is required to make one character string from two words when using loopset. Now remove the window:
% loopset kThe opening of the window This_Window can be achieved on a single line with wxploop by using the command option of wxploop. Type the following command:
% wxploop -batch -command "open This_Window"Note that the command set "open This_Window" must be within double quotes to associate the set with the command option.
To remove the window type:
% loopset kWe mentioned that the window number of 0 is the default assignment. wxploop sets up a window number associated with the process. We can specify what that number should be using the window_num option. Type the following:
% wxploop -batch -window_num 4 -command "open This_Window"then type:
% loopset k
WXPloop program not running or no message queue exists
An error message has been returned. To see why, we examine the wxploop
command line. The option -command "open This_Window" specifies
the opening of a window with title This_Window. The option
-window_num 4 specifies wxploop to open a window with id#4 to
which the title This_Window is assigned. The batch means
do all of the above before backgrounding the process and returning the
system prompt. The error comes from the fact that no window number is
specified with the loopset k command, and so loopset defaults
to look for window 0.To get rid of the window, we must now type:
% loopset -window_num 4 kThus, we see that loopset is a means of communicating with wxploop. It allows us to pass commands that we want performed by wxploop. The window_num option gives us a specific wxploop process to address if more than one invocation of wxploop is running.
NOTE: IF YOU WANT TO RUN MORE THAN ONE wxploop WINDOW FROM YOUR ACCOUNT, YOU WILL NEED TO SPECIFY A DIFFERENT WINDOW VALUE FOR window_num FOR EACH WINDOW.
% loopset -window_num < num > < wxploop command >or
% loopset -window_num < num > "< wxploop command;wxploop command;... > "The window_num is required if the wxploop process was set at a number other than the default 0, or if you are running more than one wxploop window from your account.
Commands can be strung together using semicolons, but the whole string must be within quotes because of stringing more than one command. An example:
% wxploop -batch % loopset "open;query window" Window opened with name: wxploop 13631499The number returned is the window ID. This ID is returned by the server therefore you will see a different number. More on this type of notation later when we are better aquainted with wxploop. But for now, we can show a plot by typing the command:
% sfccalc -current la -device w,,13631499which brings up the WXP shell requesting that you choose variable, etc. Note that we use device with the ending w,,13631499 where the number is the ID returned on opening the wxploop window above. After you select the various options you want to view, a sfccalc plot will appear in the wxploop window.
The next tutorail discusses the ID process that allows you to create overlays and animation.
TO REMOVE THE WINDOW, TYPE:
% loopset k
demo.geometry: 800x600+10+10Second, wxploop has a geometry default of 640x512 with cursor placement. If you always want default to be a certain size and position, you can set it in the Wxp.res file with a line such as:
wxploop.geometry: 800x600+200+200which is of the form:
< resource name > .geometry: WxH+X+Ywhere the window is width W by height H, placed at position X,Y away from the top left corner of the screen which is considered 0,0.
We now look at four general ways to open windows and then discuss which of the four to use, concluding with a brief caution note. The next six subsections are:
% wxploop -batch % loopset open This_Windowor:
% wxploop -batch -command "open This_Window"will open a window This_Window at the position 800x600+200+200 on the screen. In this case, the wxploop program is getting the geometry information from the wxploop.geometry line we put in the Wxp.res file. To remove the window, type:
% loopset k
% wxploop -batch -title "This Window" % loopset openor:
% wxploop -batch -title "This Window" -command openTyping loopset k will remove the window. Note that here we can write the window title without the underscore by using the title option.
% wxploop -batch -name demo % loopset openor:
% wxploop -batch -name demo -command open % wxploop -batch -command "open demo"Either opens a window named demo.
REMEMBER, TYPING loopset k GETS RID OF WINDOWS.
If both name and title are on the command line, name is used to load resources and then title overrides to put the title on the window.
Typing:
% wxploop -batch -name demo -title "This Window" -command openwill produce a window with the demo geometry titled This Window.
BUT typing:
% wxploop -batch -title "This Window" % loopset open demoor
% wxploop -batch -title "This Window" -command "open demo"both give a window using the demo geometry with the title demo overriding the title option.
NOTE: COMMANDS (-command) GET PRIORITY! If you use -command "open < string > ", < string > will override any title option on the wxploop command line.
% wxploop -batch -name demo -command open % loopset kOr wxploop will use the default if no resource name is used, as below:
% wxploop -batch -command open % loopset kDefault may be set using the wxploop.geometry line in the Wxp.res file. We have, infact, set this earlier in our tutorial.
If geometry is explicitly set on the command line, then it overrides all other occurrences of geometry. Thus, the following all produce the same size window and location:
% wxploop -batch -geometry 500x500+10+10 -command open % loopset k % wxploop -batch -geometry 500x500+10+10 -title "This Window" -command open % loopset k % wxploop -batch -geometry 500x500+10+10 -name demo -command open % loopset k % wxploop -batch -geometry 500x500+10+10 -command "open demo" % loopset k % wxploop -batch -geometry 500x500+10+10 -title "Window" -command "open demo" % loopset k
% wxploop -batch -command open
For a titled window at a given location, type:
% wxploop -batch -title < title > -geometry < geom > -command open
For a window using resources and having the resources name, type:
% wxploop -batch -name < name > -geometry < geom > -command open
For a window using resources, but with a different title, type:
% wxploop -batch -title < title > -geometry < geom > -name < name > -command open
or:
% wxploop -batch -name < name > -geometry < geom > -command open
% loopset set name < title_string >
NOTE: geometry on the command line overrides resources in Wxp.res.
At this point, delete the following line from your Wxp.res file:
demo.geometry: 800x600+10+10You may keep or delete the wxploop.geometry line in your Wxp.res file:
wxploop.geometry: 800x600+200+200