Drawing nothing

I need some help with a code that I cant find the error. It just draws a “blank” page (actually its gray…) And I already read it many times and cant find the error. I just started to learn python and panda3d, so sorry if the error is too simple.

import math
import direct.directbase.DirectStart
import sys
from direct.task import Task
from direct.actor import Actor
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3
from direct.showbase.DirectObject import DirectObject

class World(DirectObject):
    def __init__(self):
        self.accept('w-repeat', self.MoveForward)
        self.accept('w-up', self.setKeys, ["walk",False])
        
        #Load the first environment model
        self.environ = loader.loadModel("models/environment")
        self.environ.reparentTo(render)
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.setPos(-8, 42, 0)
        
        #Load the panda actor
        self.pandaActor = Actor.Actor("models/panda-model", {"walk": "models/panda-walk4"})
        self.pandaActor.setScale(0.005, 0.005, 0.005)
        self.pandaActor.reparentTo(render)
                
        self.updateTask = taskMgr.add(self.update, "Update") 
        
    def MoveForward(self):
        self.pandaActor.setPosX(pandaActor.getPosX() + 5)
        self.setKeys["walk",True]
    
    def setKeys(self, key, val): self.keys[key] = val    

    #Task to move the camera
    #def spinCameraTask(self, task):
    #    angleDegrees = task.time * 6.0
    #    angleRadians = angleDegrees * (math.pi / 180.0)
    #    base.camera.setPos(20 * math.sin(angleRadians), -20.0 * math.cos(angleRadians), 3)
    #    base.camera.setHpr(angleDegrees, 0, 0)
    #    return Task.cont

    def update(self, task):    
        if self.keys["walk"]:
            self.pandaActor.loop("walk")
        else:
            self.pandaActor.stop("walk") 
        return Task.cont
    

game = World

run()

if anyone could help i would apreciate it :smiley:

You’re not actually calling your World constructor, so none of the code in the World class is getting invoked.

Try replacing:

game = World

with:

game = World()

David

Thanks. It is really very simple. Because i’m not used to coding in python, that you dont need to declare things, write the type of variables, dont need semicolons… and so on