PyNGL Home > Functions > Workstation routines

Ngl.clear_workstation

Clears a specified workstation.

Prototype

Ngl.clear_workstation(wks)

Arguments

wks

The identifier returned from calling Ngl.open_wks.

Return value

   None

Description

This procedure clears (erases) a specified workstation. The single argument wks is the workstation identifier returned from a previous call to Ngl.open_wks. By default a workstation is set up to pause on the clear procedure and there must be a button click or key click in the output window before the actual clearing occurs. The pause feature can be turned on or off using the workstation resource wkPause.

See Also

Ngl.open_wks, Ngl.frame, Ngl.change_workstation, Ngl.update_workstation

Examples

The following example shows how to use Ngl.clear_workstation to allow plotting control from the keyboard without mouse clicks.

#
#  This code shows how to draw stuff, pause for 
#  user input, then erase the screen and draw more 
#  stuff, and again pause for user input.
#
import Ngl

#
#  Open an X11 workstation and turn off the default of
#  requiring a click on pause.
#
wks_type = "x11"
rlist = Ngl.Resources()
rlist.wkPause = False
wks = Ngl.open_wks(wks_type,"cn01p",rlist)

#
#  Draw a horizontal line and pause for user input.
#
Ngl.polyline_ndc(wks,[0.,1.0],[0.5,0.5])
Ngl.update_workstation(wks)
raw_input("Proceed on input >")

#
#  Erase the horziontal line, draw a vertical line and pause 
#  for user input.  If the clear_workstation is not done, then
#  the horizontal line will not be erased.
#
Ngl.clear_workstation(wks)
Ngl.polyline_ndc(wks,[0.5,0.5],[0.0,1.0])
Ngl.update_workstation(wks)
raw_input("End on input >")

Ngl.end()