Re: display.dispose,jframe.close()

Garrett:

If you can live with the method name "desty" then you don't need to
define your own kill().  Just invoke desty(None) since the name
"event" is not used.

Your other change -- returning the myFrame object created -- could be
made a permanent change, since the only downside is that when a
"showDisplay()" is run from the command line, it would print out
an str of that (whatever that might be).  If that would be helpful and
not too onerous, just let me know...

Another option would be to make your own JFrame to hold the display
and your "Close" button.  Then create a JPanel and pass it's
getContentPane() into showDisplay() as the last parameter -- that way
showDisplay should just put the VisAD display in there for you.

tom

On Mon, 4 Mar 2002, Campbell, Garrett wrote:

> I am using the jython scripts set up by Tom W.
> I would like to close the display windows within the .py script.
>
> I did this by modifying the subs.py:
>
> def showDisplay(display, width=300, height=300,
>                 title="VisAD Display", bottom=None, top=None,
>                 panel=None):
>   mf=myFrame(display, width, height, title, bottom, top, panel)
>   return mf
>
> class myFrame:
>
>   def desty(self, event):
>     self.display.destroy()
>     self.frame.dispose()
>
>   def kill(self):
>     self.display.destroy()
>     self.frame.dispose()
> ..
>
> then I can do mf.kill()
>
> This simulates the user clicking the window close icon.
>
> Is there a better way without modifying the semi standard routines in
> subs.py and graph.py?
>
> G. Garrett Campbell Ph. D.
> Cooperative Institute for Research in the Atmosphere
> Colorado State University
> Ft. Collins, CO, USA
> 970 491 8497
> campbell@xxxxxxxxxxxxxxxxxx
>

--
Tom Whittaker
University of Wisconsin-Madison
Space Science and Eng. Center
ph:  608.262.2759


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: