From: petro f. <pet...@gm...> - 2008-03-25 03:07:35
|
Hi All, I am calling scene to display an object from tk, I know how to hide / visible the scene but i don't know how to close or dispose the scene without exit all programs. I click at up right conner button of the scene to dispose/close it but it exit all programs/tk main program! I look at the documentation of visualpython there is no explanation of WINDOW_ON_CLOSE, WINDOW_ON_EXIT ..etc on the scene. i use visualpython ver2.5-3.2.11 Does someone can show me a simple program to dispose the scene which call from a method ? or tell me where is good documentation/references. Thank you very much |
From: Bruce S. <Bru...@nc...> - 2008-03-25 03:55:05
|
I'm not quite sure what it is you want to do, and I don't recognize your references to "WINDOW_ON_CLOSE" and "WINDOW_ON_EXIT", but here are two relevant points: 1) As stated in the Visual help, setting scene2.exit = False means that clicking the close box on the display named "scene2" closes that display but doesn't halt the program and doesn't close other displays. 2) You can dispose of a display "scene2" by saying scene2.visible = False, then scene2 = None. Python maintains a count of references to every object. For example, a = [1, 2, 3] and b = a means that there are two references to the list. If you then say b = 5 or b = None, there is only one reference to the list. If you then also say a = 3 or a = None, there are no references to the list, no way to refer to the list, and Python is free to delete the list from memory and free up that memory. In Visual, there's one extra reference in the reference count of an object or display, namely the human viewer. If a = sphere(), the reference count for the sphere object is 2. If you then say a = None, the reference count decrements to 1 (the human viewer), and the sphere will not be deleted by Python. If you do want to delete the sphere from memory, first say a.visible = False, then a = None; this will decreases the number of references to the sphere to zero. Here is the summary in the Visual help: Deleting an Object To delete a Visual object just make it invisible: ball.visible = 0 Technical detail: If you later re-use the name ball, for example by creating a new object and naming it ball, Python will be free to release the memory used by the object formerly named ball (assuming no other names currently refer to that object). Bruce Sherwood petro finder wrote: > Hi All, > > I am calling scene to display an object from tk, I know how to hide / > visible the scene > but i don't know how to close or dispose the scene without exit all > programs. > I click at up right conner button of the scene to dispose/close it but > it exit all programs/tk main program! > I look at the documentation of visualpython there is no explanation of > WINDOW_ON_CLOSE, WINDOW_ON_EXIT ..etc on the scene. i use visualpython > ver2.5-3.2.11 > Does someone can show me a simple program to dispose the scene which > call from a method ? > or tell me where is good documentation/references. > > Thank you very much > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: petro f. <pet...@gm...> - 2008-03-25 07:09:44
|
Hi Bruce, Now I can dispose my scene ..very happy :D I dont read carefully the visual help ( on visual help write as sceneb ...not scene , actually it's same ...) but when I clicked close is oke to close the scene but the program is getting hang there are code of animation.. while 1: rate(100) for self.wave in self.waves: ..bla..bla.. it's came from visual example - wave.py I think when I close the scene window, it was not clear all the process that running within scene. Question ..I should fixed the code ? or there are method of scene to clear all process? Thank you very much. 2008/3/25, Bruce Sherwood <Bru...@nc...>: > > I'm not quite sure what it is you want to do, and I don't recognize your > references to "WINDOW_ON_CLOSE" and "WINDOW_ON_EXIT", but here are two > relevant points: > > 1) As stated in the Visual help, setting scene2.exit = False means that > clicking the close box on the display named "scene2" closes that display > but doesn't halt the program and doesn't close other displays. > > 2) You can dispose of a display "scene2" by saying scene2.visible = > False, > > Bruce Sherwood > |
From: Bruce S. <Bru...@nc...> - 2008-03-25 15:06:23
|
Naming issues: A window containing VPython graphics is a VPython "display" object. By default, when you create a sphere or other displayable object VPython creates a display object named "scene". In documentation you'll find names like "sceneb" or "scene2" as examples of displays other than the default one. from visual import * box() # by default, a display named "scene" is created, with a box scene2 = display() sphere() # this sphere will appear in a second display named "scene2" It is the case that if you have display.exit = False, closing that display doesn't terminate the program. I guess you could watch for that display or its contents no longer existing as a signal to stop the program. Bruce Sherwood petro finder wrote: > Hi Bruce, > Now I can dispose my scene ..very happy :D > I dont read carefully the visual help ( on visual help write as sceneb > ...not scene , actually it's same ...) > > but when I clicked close is oke to close the scene but the program is > getting hang > there are code of animation.. > while 1: > rate(100) > for self.wave in self.waves: > ..bla..bla.. > it's came from visual example - wave.py > I think when I close the scene window, it was not clear all the process > that running within scene. > Question ..I should fixed the code ? or there are method of scene to > clear all process? > > Thank you very much. > > > > > > 2008/3/25, Bruce Sherwood <Bru...@nc... > <mailto:Bru...@nc...>>: > > I'm not quite sure what it is you want to do, and I don't recognize your > references to "WINDOW_ON_CLOSE" and "WINDOW_ON_EXIT", but here are two > relevant points: > > 1) As stated in the Visual help, setting scene2.exit = False means that > clicking the close box on the display named "scene2" closes that display > but doesn't halt the program and doesn't close other displays. > > 2) You can dispose of a display "scene2" by saying scene2.visible = > False, > > Bruce Sherwood > > |