Stupid question about the Panda3D python API reference pages

Hi all,

I think I may just be exceptionally dense when it comes to reading the API documentation. The manual is great and all, but as I start looking to do more and more advanced things I find myself using the reference a lot more. However, I can’t figure out how in the heck to read it!

So, for example, let’s say I wanted to look at what arguments setX takes. I go to the python reference page, great loads up the class reference by default. I have no idea which class(es) setX is a part of. I click the ‘Class Members’ tab then click ‘s’ to search for setX(), and there it is!

But…now I see now place to be told what arguments it takes. I guess I’m used to reading documentation of languages which is typically class/function name, arguments and examples.

Please, someone tell me I’m just missing an extra link to find sample usage of every function I would typically look for.

p.s. I know how to use setX, or SetPos, or whatever, it was just an easy example. My question is just more on the documentation in general.

Thanks!
ZM

setX is a property of the NodePath class. When looking at the documentation for an instance (like base.render), you’ll always have to look up the class that it is of.

You can check the type by typing this in the Python interpreter:

# Either one will probably work
print type(base.camera)
print base.camera.__class__

Also note Python’s help() function, which displays an API reference for something in the interpreter itself:

# You could use any of these
help(base.camera)
help(base.camera.setX)
help(NodePath)
help(NodePath.setX)

Thanks! I had looked at the different class documentation. I just thought it would be nice since things like setX, setY, setZ, setPos are all nearly the same in function and in how they’re written alphabetically if their arguments would be easily accessible on the same page right from the functions page. Ah well, the longer I use Panda the more intuitive it gets, so it’s probably best I have to do the leg work to look up the class. :slight_smile:

Thanks again!
ZM

Actually, you can access all methods in all classes that start with “s” here:
panda3d.org/reference/pytho … hp#index_s

setX, setY, setPos etc. are there, and a list of classes that have those methods.

Oh, yeah, I saw that. I’m sorry, I wasn’t clear. I was basically looking for a version of that page, but instead of only having classes, it would have the arguments.

Maybe something like:

setX: setX(float value)
Example “self.player.setX(self.player, +4)”
Classes: NodePath …(others here too)

I know, I’m knit picking…I just hate having to navigate another level to find basic syntax…even if the syntax example is just the most class example with details when you click on the other class.

The reason I’m asking is I find myself a lot of times going to this page, finding the function I’m looking for, opening a couple of classes in a new tab and looking for other ones and doing the same thing. I end up with a ton of tabs open whereas I would never have to open a new tab, or navigate away from the page you linked to get the syntax/arguments.

Edit: I don’t know why I put this in the scripting issues, as this is obviously more a preference about the site layout. :wink:

Putting all possible prototypes of every method on that page would bloat it beyond all belief, it’d make visiting that page horribly slow in many browsers.

The usual approach is to look up the class that the method is in first, and then looking up the method on that class’ API reference page.