DirectButton Problem

Hi, i’m sortof new to panda. I’ve used it before but now im back to carry on using it. Anyway, i have a problem with Direct Button. I’ve used egg-texture-cards to make a button and i put it into my button:

bob = DirectButton(scale = 0.5,text = (“OK”, “Click”, “OK”, “nouse”),command=setText,pos=(0.6, -0.95, 0), geom = (maps.find(’/Button_Ready’),
maps.find(’
/Button_Clicked’),
maps.find(’/Button_Rollover’),
maps.find(’
/Button_Disabled’)))

It shows the button i made but it also shows the default button behind it. How do i get rid of the default button?

Yet anouther problem to add to this list is self.setKey:

This is correct no?
i missed out other bits of code that arent relevant to this problem. Any help would be mutch apreciated, thanks.

what’s exactly your problem with the code snippet you posted, charlando? as you mentioned, it’s incomplete - so i’m not quite sure, what you want to achieve. do you miss self.setKey? do you get a traceback or is the behaviour not as expected?

i used the roaming ralph tutorial as a basis for my own stuff and had no problems so far regarding that code.

maybe if you explain your problem in more detail, someone could help.

ps: unfortunatly i can’t help with your DirectButton problem as I haven’t yet used the GUI classes.

sorry, trust me to miss out the main part :stuck_out_tongue:
The problem is i get an error saying
“AttributeError: World instance has no attribute ‘setKey’”
I have no idea why it didnt work, i got this code from the Roaming Ralph tutorial.

you didn’t copy the setKey method from the class into your code (see the tutorial code again). here it is:

    #Records the state of the arrow keys
    def setKey(self, key, value):
        self.keyMap[key] = value

hope that helps,
kaweh

gee thanks :smiley: i think that worked :slight_smile:
but now the camera doesent move??? it loads fine but the camera doesent move when i press a

really hard to say without seeing the code. i assume you lost something during the transition to your own code.

i recommend to re-check with the original code (roaming ralph) and see where you differ.

hth,
kaweh

oh, dont worry, its working :slight_smile: Thanks for all the help. Hopefully i can finnish my game soon. Ill post it on the forums when im done.