Issue quiting panda game

hi,

for some reason my panda3D app won’t quit and returns no error’s.

def quit():
    sys.exit
    print "should have quited"

def mainMenu():
    def quitGame():
        def itemSel(arg):
            if(arg):
                quit()
            else:
                quitMenu.cleanup()
            
        quitMenu = YesNoDialog(dialogName="YesNoCancelDialog", text="Do you want to quit?", fadeScreen=1, command=itemSel)
        
    base.accept("escape", quitGame)
    

I don’t know what I am doing wrong?

Does it prints “should have quited”? In that case, the problem likely is you’ve a sort of no-op with sys.exit, it should be sys.exit(). Otherwise please post more code (a little complete program to experiment on it more fastly).

Thanks yaio by adding the brackets it quited as it should have. I copied sys.exit from roaming Ralph escape command which is why it didn’t have brackets

Thanks again

It was probably in base.accept(), in this case it shouldn’t have, if you need to pass function argument, you use base.accept(‘a’, sys.exit, extraArgs = )

ok so if I wanted to use an arg with keyboard I would do

base.accept("w",wireframe, extraArgs=[true])

is this correct or do I not need the brackets.

“Arg with keyboard”?

Again, you do not write the brackets of a function when you pass it as an argument to a accept call. A question then arises, what if that function needs arguments? Then you use another optional argument in your accept call, “extraArgs” which is a list.
panda3d.org/manual/index.php/Event_Handlers

“Arg with keyboard”?

Again, you do not write the brackets of a function when you pass it as an argument to a accept call. A question then arises, what if that function needs arguments? Then you use another optional argument in your accept call, “extraArgs” which is a list.
panda3d.org/manual/index.php/Event_Handlers

If you are referring to the square brackets, then yes they are required. This way you can pass multiple args if you want ([True, True, False] for example). Don’t forget to capitalize true (True).