base.camera.setPos(...)
Though self does not apply:
self.base.... [ error ]
Although base seems to be the same as self:
self.camera.setPos(...) [ works ]
So what’s the deal with Python and the self keyword here? To my understanding, a member variable would be declared via self.someVar …and later referenced via self.someVar too. Absence of self implies a local variable that drops out of scope post-method.
Why do I not need the self keyword for render?
Why do I not need the self keyword for base?
Could be me being a thick Python n00b, but thought I’d ask!
It certainly does break rules. This kind of builtin stuffing was done back when Panda was just an internal tool for a small group of people. It doesn’t make as much sense for a robust middleware graphics engine to do this, but now we’re stuck with it because too much existing code relies on it.
That’s a stylistic thing. I don’t think it matters much whether you inherit from ShowBase or not; but you need to instantiate a ShowBase in order to open a window (unless you want to write all of the ShowBase code yourself); and you also need a place to put your own application-specific code, so it often makes sense to put it in class that inherits from ShowBase. But there’s no requirement that you do so.