In looking at the docstring for the runAction event handler on Perspective components, I was not sure what the object was for the "event" parameter.
In Component Events and Actions online documentation, I first saw this image that described what I thought was the docstring for the On Click handler (Narrator - It wasn't):
With the event parameter described as:
event: An object with the following attributes:
However, I have no idea what that image is related to. I was drawn to it because it looked like what I was looking for.
Further down the page I encountered the correct On Click handler image:
In the designer, the doctoring matched what is shown in the documentation
With the event parameter described as:
event: Events fired by the relevant mouse/touch interaction
The designer docstring doesn't mention that "event" is an object, and I didn't know how to use it from that text.
However in the online documentation it does say
Script actions contain a built-in "event" object, that further contains values pertaining to the underlying event. These values and descriptions are displayed in the docstring.
My take aways from this are:
I posted this way too quick, and made lots of errors and false accusations
I'm not sure what that first docstring image I encountered actually pertains to
Mentioning that "event" is an object in the OnClick docstring (as per that weird image) would be a great help.
Using dir on any python object will list out all the properties and method on it. So if you are in doubt, dir(event) will tell you whats there.
I think @pturmel wrote a script somewhere on this forum as well that does dir but nicer - it will tell you what specifically is a property and what is a method.
FWIW right underneath event it seems to be defining some properties available on the event like altKey (bool). It’s indented inside of event so its apart of event.
The use of “dir” is probably a good general problem solving technique to have under my belt, but given the where “event” is defined, I’m guessing that I’d need to do this in an event script and send the output to the wrapper log.
Yea fair enough. Though again it does seem like it is telling you some stuff about event in pictures you posted as well. In your I can see in your picture altKey is a property of the event.
I am assuming they are only listing things relevant in the runAction context as if you run a dir on event, you will see a lot of properties and methods that you most likely never use or need.
What property did you find yourself needing/using that was not in the doc string?
No, please don't. Once someone replies, I think it is courteous to leave as is for future readers. What you may think is a silly mistake is still educational for others.
I am on the fence over this. On one hand, leaving the history is informative. On the hand, the entire initial premise of the thread was wrong, and I’d prefer to leave a clear, concise post of the actual issue.