RE: [pyngl-talk] closing an x11 window

From: Ertl, John <john.ertl_at_nyahnyahspammersnyahnyah>
Date: Tue, 21 Dec 2004 10:07:39 -0800

Fred,

That did the trick. Happy Holidays.

Thanks,

John Ertl

-----Original Message-----
From: Fred Clare [mailto:fred_at_ucar.edu]
Sent: Tuesday, December 21, 2004 10:00
To: Ertl, John
Cc: 'pyngl-talk_at_ucar.edu'
Subject: Re: closing an x11 window

John,

Try Ngl.destroy(wks). This will kill the
workstation, so if you want to draw into
another window, you will have to open another
workstation. For example:

import Ngl

x = [10., 20.00, 30., 40.0, 50.000, 60.00, 70., 80.00, 90.000]
y = [ 0., 0.71, 1., 0.7, 0.002, -0.71, -1., -0.71, -0.003]

wks = Ngl.open_wks("x11","ngl01p") # Open a workstation.
plot = Ngl.xy(wks,x,y) # Draw an XY plot.
Ngl.destroy(wks) # Remove the X11 window.

x = [10., 20.00, 30., 40.0, 50.000, 60.00, 70., 80.00, 90.000]
y = [ 0., 0.31, 1., 0.3, 0.002, -1.01, -2., -0.71, -0.003]

wks = Ngl.open_wks("x11","ngl01p") # Open a workstation.
plot = Ngl.xy(wks,x,y) # Draw another XY plot.

Fred Clare

---------------------------------------------
Fred Clare fred_at_ucar.edu 303-497-1284
Visualization & Enabling Technologies Section
NCAR Scientific Computing Division
---------------------------------------------

On Tue, 21 Dec 2004, Ertl, John wrote:

> I have a larger program that has a PyNGL function that uses the x11 window
> to display a grid. Up until now I have only displayed one grid then the
> program ended when I clicked on the image. Now I want to put the image
code
> into a loop (not an animation) but each x11 window stays up until the
> program ends. When I click window the image goes away but the window is
> still up. I have tired several unsophisticated python and PyNGL things
> including the os.wait() and del map but no luck.
>
> Does any one know how to get the x11 window to close with the program
still
> running? I have not been able to run the examples to see if I can
reproduce
> the problem with code provided but does any one have a suggestion.
>
> John C. Ertl
> Fleet Numerical Meteorology & Oceanography Center
> 7 Grace Hopper Ave
> Monterey, CA 93943
> phone: (831) 656-5704
> fax: (831) 656-4363
>
> def view(self):
> wks = Ngl.open_wks("x11","ditch.test",None)
> rlist = Ngl.Resources()
> Ngl.set_values(wks,rlist)
> grid = self.binvalues
>
> grid_lon = Numeric.arange(0,360,.5)
> grid_lat = Numeric.arange(-90,90,.5)
> grid_nlon = len(grid_lon)
> grid_nlat = len(grid_lat)
>
> resources = Ngl.Resources()
>
> resources.sfXCStartV = min(grid_lon)
> resources.sfXCEndV = max(grid_lon)
> resources.sfYCStartV = min(grid_lat)
> resources.sfYCEndV = max(grid_lat)
>
> resources.cnFillDrawOrder = "Predraw" # Draw contours
> first.
>
> resources.cnLinesOn = False
> resources.cnFillOn = True # Turn on contour fill.
> resources.cnLineLabelsOn = False # Turn off line labels.
> resources.cnInfoLabelOn = False # Turn off info label.
> resources.lbPerimOn = False # Turn off label bar
> perim.
> resources.mpPerimOn = True # Turn on map perimeter.
>
> map = Ngl.contour_map(wks,grid,resources)
> _______________________________________________
> pyngl-talk mailing list
> pyngl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Tue Dec 21 2004 - 11:07:39 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 19 2006 - 21:30:17 MST