Using DirectButton


I just started using Panda3d. I need a little help with DirectButton. I have a button thats I have created and I want this button to run the main program when clicked. How do I go about this?

First, understand that your program is already running before you click the button–something, after all, has to display the button and handle the click.

But you can have the button start a part of your program that does whatever you consider “the main program”. Put the code to do this in a function, and pass this function to the ‘command’ keyword of DirectButton, as shown in the manual.