object visibility not changed in handling a menu option

5 views
Skip to first unread message

Joe Heafner

unread,
Oct 12, 2022, 6:01:24 PM10/12/22
to Web VPython Users
I'm prepping for a Web VPython workshop and this little demo showing how to use a simple menu works fine except for one thing. When the user selects the 0 item in the menu after having selected one of the other items, the handler should set CurrentObject.visible to False but that isn't happening. The print statement executes though. Am I missing something obvious?

https://www.glowscript.org/#/user/heafnerj/folder/Workshop/program/menudemo

Joe Heafner
Sent from one of my Macs


Bruce Sherwood

unread,
Oct 12, 2022, 6:51:09 PM10/12/22
to glowscri...@googlegroups.com
You need to insert "return" at the end of handling m.index == 0, because at the end of the M function you execute CurrentObject.visible = True

Bruce

Joe Heafner

unread,
Oct 12, 2022, 7:00:38 PM10/12/22
to Web VPython Users

> On Oct 12, 2022, at 18:50, Bruce Sherwood <bruce.s...@gmail.com> wrote:
>
> You need to insert "return" at the end of handling m.index == 0, because at the end of the M function you execute CurrentObject.visible = True

AAAAAAH! I should've caught that! Many thanks!
Reply all
Reply to author
Forward
0 new messages