AttributeError: type object 'ShowBase' has no attribute 'mouseWatcherNode' -- installation problems or i just messed up?

well i just got started and after few hours tossed to gather this thing from few tutorial scripts from official docs, and how you can see from the name i never got passed this point.

from panda3d.core import KeyboardButton
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import MouseWatcher
from panda3d.core import ButtonHandle

class MyApp(ShowBase):
def init(self):

    self.scene = self.loader.loadModel("za_wardo_1.glb")


    self.scene.setScale(4, 4, 4)
    self.scene.setPos(-8, 42, 0), 320, 0)
    self.direction = "None"
    self.PlrX,self.PlrY,self.PlrZ = 0,0,0
    self.speed = 0.2
    self.forward_button = KeyboardButton.ascii_key('w')
    self.backward_button = KeyboardButton.ascii_key('s')
    self.left_button = KeyboardButton.ascii_key('a')
    self.right_button = KeyboardButton.ascii_key('d')

    self.taskMgr.add(self.camera_follow, "camera_follow")
    self.taskMgr.add(self.move_task, "move_task")

def camera_follow(self,task):,self.PlrY - 2,self.PlrZ + 3)

    return Task.cont

def move_task(self, task):

    is_down = ShowBase.mouseWatcherNode.is_button_down

    if is_down(self.forward_button):
        self.PlrY += self.speed

    if is_down(self.backward_button):
        self.PlrY -= self.speed

    if is_down(self.left_button):
        self.PlrX -= self.speed

    if is_down(self.right_button):
        self.PlrX += self.speed

app = MyApp()

if you can help, would be much appreciated

I think that “mouseWatcherNode” is an instance variable, not a class variable–that is, it’s accessible from individual objects of the “ShowBase” class, but not from the class itself.

However, you’re attempting to access it as a class variable–as “ShowBase.mouseWatcherNode”, “ShowBase” being a class.

If you’re unfamiliar with instance variables and classes, let me give a quick illustration:

class MyClass():
    def __init__(self): = "mew"

myInstance = MyClass()

print (    # produces an error
print ( # prints "mew"

So, instead of attempting to access “mouseWatcherNode” from the class itself, try accessing it from an instance of ShowBase–most likely, I imagine, from the “self” instance defined within your “ShowBase”-descended “MyApp” class. Something like this:

        is_down = self.mouseWatcherNode.is_button_down

(A quick note: If you want to access an instance variable of ShowBase from outside of your class, Panda provides a convenience global variable that points to the main “ShowBase” object, called base. You could thus use something like “base.mouseWatcherNode”. Better yet, your main class is descended from ShowBase, and is likely to be the main application object. Thus your main application object will likely be the object referenced by “base”, giving you similar access to the variables of your main application, too.)