Terminal To Gui

So I’ve been making a game using Panda3D and Python, and I’ve been using raw_input (which is an extremely inefficient way to do almost anything). I’d like to convert it to a directbutton. I’ve made the buttons and everything, but the term I was using isn’t specified because you can’t press buttons before you play the game. Is there any way to prevent this error?

I’m not entirely clear on what you want to do. In particular, what information do you want to gain access to that isn’t available once the program is running? And what do you mean by “the term I was using”?

I’m guessing that “the term I was using” is whichever variable was originally made from raw_input but is now being created in the function called when the button is pressed. I’m also guessing that the program doesn’t compile because the construction of that variable is inside the pressed button function, but is accessed outside of that function. The solution to this would be creating an empty version of that variable on program start and having the button press function fill in the values you want.

Take the variable that you are creating and wrap it up in a function. For example, instead of:

color = raw_input('Choose your color')

You could do something like:

color = None
def chooseRed():
    global color
    color = 'red'
b = DirectButton(relief=None, text='Red', command=chooseRed)

Hope this helped.
-Bear E.

Thanks @funnybear465, this helped me create makeatoon for ToonDNA.py