Object under mouse None problem -
06-25-2009, 01:20 AM
Hi,
I am using Alice 2.2 We are using the "when the mouse is clicked on anything, do clickedMethod, clickedThing = objectUnderMouse"
If the sky is clicked on, it sends a None object to the clickedMethod, which causes a crash. I seem to recall fixing this is 2.0 by using the expanded "during" option, but that doesn't seem to work here.
We attempted to work around that by putting acceptable objects in a list, and using
if acceptableObjects contains clickedThing, then do the behaviour.
But the "contains" function did not seem to work as far as I can tell.
Any suggestions?
I did create one horrible workaround. I made a local variable "emptyList", which is a list of objects, populated with None. I can now compare
if clickedThing != first item from emptyList then do the behaviour.
But I would prefer not trying to explain that to our camp of middle schoolers. So if there is a more rigorous way of avoiding this issue, I would appreciate it.
Thanks,
David
|