Documentation: Perspective runAction docstring needs more detail

This is on 8.1.15, for Perspective

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):

Screen Shot 2022-04-21 at 6.29.41 AM

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

Screen Shot 2022-04-21 at 6.31.52 AM

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:

  1. I posted this way too quick, and made lots of errors and false accusations
  2. I’m not sure what that first docstring image I encountered actually pertains to
  3. Mentioning that “event” is an object in the OnClick docstring (as per that weird image) would be a great help.
  4. I’ve flag an admin to delete this thread

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.

But anyway, my issue is with the documentation :wink:

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?

See my walk of shame update to my OP. :face_with_open_eyes_and_hand_over_mouth:

Everything I need was in the docstring, What was missing was mentioning that it was an object

Everything in python is an object

1 Like

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.

2 Likes

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.

But you’ve already fixed it up. Maybe tweak the title a bit. :man_shrugging: