To hide a VPython object just make it invisible: ball.visible = False. This does not delete the object from computer memory, and you can make it visible again later.
Currently it is not possible to use del ball to delete a Web VPython object.
You may try the following codes:
delAllButton = button(text = "Delete All", bind = delAll)
def delAll():
for thisBall in ballList:
thisBall.visible = False
del thisBall
ballList.clear()
The way of for-loop you use is wrong. I used to have the same problem. You can trace the ballList, and find what is going on.
CKJ
從 Windows 的郵件傳送
寄件者: Mark Schaedel
傳送時間: 2022年2月8日 22:05
收件者: Glowscript Users
主旨: [glowscript-users] Deleting Objects
--
---
You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glowscript-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glowscript-users/156fe619-70c4-4326-b6f0-ba5fa857c8fan%40googlegroups.com.