From: Stef M. <s.m...@ru...> - 2008-11-27 23:59:36
|
hello, I have a few simple questions, for which I can't find the answer in the doc: - how can I remove an object from the scene ? - how can I clear the whole scene ? thanks, Stef Mientki |
From: Bruce S. <Bru...@nc...> - 2008-11-28 01:59:24
|
From the section of the help titled "Deleting an object" there is this: 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). (If you simply make an object invisible, you might later make it visible again. But if you reassign the name, there is no longer any way for your program to access the object, so its memory can be released.) Similarly, a display such as scene can also be made invisible (scene.visible = 0), and if its name is reassigned the memory is released. If on the other hand you want to keep the window visible but remoe all objects from it, you need to make all the objects in the display invisible. In the section titled "Controlling Windows" there is this note about how to get at all the (visible) objects in a display: objects A list of all the visible objects in the display; invisible objects are not listed. For example, this makes all boxes in the scene red: for obj in scene2.objects: if obj.__class__ == box # can say either box or 'box' obj.color = color.red Bruce Sherwood Stef Mientki wrote: > hello, > > I have a few simple questions, > for which I can't find the answer in the doc: > > - how can I remove an object from the scene ? > - how can I clear the whole scene ? > > thanks, > Stef Mientki > > |
From: Stef M. <s.m...@ru...> - 2008-11-28 14:36:25
|
thanks Bruce, Bruce Sherwood wrote: > From the section of the help titled "Deleting an object" there is this: I thought I printed everything, but I missed that small piece of doc. That brings up the following: wouldn't be a good idea to merge all the tiny html docs into just 1 pdf file ? > > 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). > > (If you simply make an object invisible, you might later make it > visible again. But if you reassign the name, there is no longer any > way for your program to access the object, so its memory can be > released.) > > Similarly, a display such as scene can also be made invisible > (scene.visible = 0), and if its name is reassigned the memory is > released. > > If on the other hand you want to keep the window visible but remoe all > objects from it, you need to make all the objects in the display > invisible. In the section titled "Controlling Windows" there is this > note about how to get at all the (visible) objects in a display: > > objects A list of all the visible objects in the display; invisible > objects are not listed. For example, this makes all boxes in the scene > red: > > for obj in scene2.objects: > if obj.__class__ == box # can say either box or 'box' > obj.color = color.red Aha, that's what I really need, as I dock the scene (so it's complex to define a new one and dock it again), and I don't know what objects are on. thanks very much. Maybe I've not yet the right to do suggestions (didn't really use Vpython), but on the other hand these first suggestions are often forgotten when you start knowing an environement and find work arounds. So I do them anyway: - set one way autoscale: autoscale can zoom out to show the whole environment if the environment grows, but it's not allowed to shrink - set the maximum/minimum values of zoomfactor. I use a pen instead of a mouse, which is much faster, when I try to zoom, I loose my picture within sceonds by zooming too much in or out. The only way to restore that is to restart the program :-( btw, I love the way VPython is automated, so you only have to deal with the real problem you're interested in, great ! btw2, I'll try to make a demo this weekend, showing how I integrated VPython in PyLab_Works. cheers, Stef > Bruce Sherwood > > Stef Mientki wrote: >> hello, >> >> I have a few simple questions, >> for which I can't find the answer in the doc: >> >> - how can I remove an object from the scene ? >> - how can I clear the whole scene ? >> >> thanks, >> Stef Mientki >> >> > > |
From: Bruce S. <Bru...@nc...> - 2008-11-28 18:38:57
|
I don't have the energy to try to create one pdf out of all the html files, but maybe someone else would like to do this. However, don't embark on such a project yet, because we're about to release Visual 5 with a major restructuring of the help. I should mention that I've sometimes run across the misperception that the documentation is only available on the internet, and so it's important to have hard copy or a pdf in case you don't have internet access. But in fact the help is installed on your local machine when you install VPython, and accessible from the IDLE help menu, so internet access is irrelevant. In Visual 5 autoscale does indeed zoom out but not in, to prevent "fibrillation" (easily seen in the bounce.py example in the current Visual 3). Your suggestion of limits on zoom is interesting. Thanks for the suggestion. Bruce Sherwood Stef Mientki wrote: > thanks Bruce, > > Bruce Sherwood wrote: >> From the section of the help titled "Deleting an object" there is this: > I thought I printed everything, but I missed that small piece of doc. > That brings up the following: > wouldn't be a good idea to merge all the tiny html docs into just 1 pdf > file ? >> 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). >> >> (If you simply make an object invisible, you might later make it >> visible again. But if you reassign the name, there is no longer any >> way for your program to access the object, so its memory can be >> released.) >> >> Similarly, a display such as scene can also be made invisible >> (scene.visible = 0), and if its name is reassigned the memory is >> released. >> >> If on the other hand you want to keep the window visible but remoe all >> objects from it, you need to make all the objects in the display >> invisible. In the section titled "Controlling Windows" there is this >> note about how to get at all the (visible) objects in a display: >> >> objects A list of all the visible objects in the display; invisible >> objects are not listed. For example, this makes all boxes in the scene >> red: >> >> for obj in scene2.objects: >> if obj.__class__ == box # can say either box or 'box' >> obj.color = color.red > Aha, that's what I really need, > as I dock the scene (so it's complex to define a new one and dock it again), > and I don't know what objects are on. > thanks very much. > > Maybe I've not yet the right to do suggestions (didn't really use Vpython), > but on the other hand these first suggestions are often forgotten when > you start knowing an environement and find work arounds. > So I do them anyway: > - set one way autoscale: autoscale can zoom out to show the whole > environment if the environment grows, but it's not allowed to shrink > - set the maximum/minimum values of zoomfactor. I use a pen instead of a > mouse, which is much faster, when I try to zoom, I loose my picture > within sceonds by zooming too much in or out. The only way to restore > that is to restart the program :-( > > btw, I love the way VPython is automated, so you only have to deal with > the real problem you're interested in, great ! > > btw2, I'll try to make a demo this weekend, showing how I integrated > VPython in PyLab_Works. > > cheers, > Stef > >> Bruce Sherwood >> >> Stef Mientki wrote: >>> hello, >>> >>> I have a few simple questions, >>> for which I can't find the answer in the doc: >>> >>> - how can I remove an object from the scene ? >>> - how can I clear the whole scene ? >>> >>> thanks, >>> Stef Mientki >>> >>> >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |