-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarify event handler docs #144
Comments
Near the top of the page to which you linked, the text "messenger.send" is clickable, and takes one to the API page for the messenger. To quote that page:
I imagine that this comes down to the design philosophy of whoever coded that class. After all, it's not that uncommon for the printing of an object to prompt it to print some of the current data of that object--printing a "RenderState" object, for example, gives a brief summary of that states contained within.
I don't think that one does: "messenger" seems to be one of the ubiquitous global variables. If you have a ShowBase object, then you should be able to access it from there. Like so: class MyGame(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# I'm using "print" here simply because it's a use
# for messenger that I have in mind right now.
print (messenger)
# Or
print (self.messenger) |
Wow, it is. @rdb can we change the formatting for this, because that does not read like a link to me.
Yes. ...
... something like that piece of code should be in the manual, because I don't think this is obvious. |
messenger is documented here: We could add an explanation of the global to the API reference page of the Messenger class. |
It could be as simple as linking to the page to which you just linked. Something like: |
Hello, just a quick note since I'm doing something else:
I find this bit about event handlers not clear enough.
https://docs.panda3d.org/1.10/python/programming/tasks-and-events/event-handlers
"
Finally, there are some useful utility functions for debugging. The messenger typically does not print out when every event occurs. Toggling verbose mode will make the messenger print every event it receives. Toggling it again will revert it to the default. A number of methods exist for checking to see what object is checking for what event, but the print method will show who is accepting each event. Also, if accepts keep changing to the point where it is too confusing, the clear method will start the messenger over with a clear dictionary.
"
What is this messenger, how does it relate to anything, why are we using "print" and not something like
.get_events()
.And how do I import it? That's not in the code bit.
The text was updated successfully, but these errors were encountered: