Questions about display

27 views
Skip to first unread message

Raul Morales Juberias

unread,
Aug 27, 2016, 12:45:06 AM8/27/16
to Glowscript Users
Hello all, 

When working with glowscript what are the best ways to:

- Pause temporarily the execution of a program that has multiple parts.
- Clean the display
- Save the display content to an image (gif, png or other)

Thanks,

Raul

Bruce Sherwood

unread,
Aug 27, 2016, 12:51:14 AM8/27/16
to Glowscript Users
1) scene.pause() # assuming the canvas is named scene, the default canvas

2) scene.delete()

3) There is currently no way to save the image other than to use screen-capture tools built into your computer. For example, on Windows the Snipping Tool is very nice for this purpose.

Bruce Sherwood

unread,
Aug 27, 2016, 12:55:04 AM8/27/16
to Glowscript Users
I should add that if you want to keep the canvas but delete all the objects in that canvas, here is an excerpt from the Help, in the section on canvases, where in this loop you would set obj.visible = False:

objects A list of all the visible objects in the canvas; invisible objects and lights are not listed (scene.lights is a list of existing lights). For example, the following makes all visible boxes in the scene red:


    for obj in scene2.objects: 
        if isinstance(obj, box):
            obj.color = color.red



Reply all
Reply to author
Forward
0 new messages