Bug in DirectDialog?

Hi all,

I think I found a bug in DirectDialog. Well, actually, its not really a bug, more a suggestion.
Would it be hard to have a possibility to have also extraArgs for the commands for the DirectDialog buttons?

Like, when I click No in my dialog, it will call the appropriate function, but will also pass extra arguments to that function? If I do right now “extraArgs=[arg,arg]” that is just ignored.

Thanks. :slight_smile:

this is my quick & dirty approach :

      dialog = YesNoDialog(dialogName='YesNoDialog1')
      YesBtn, NoBtn = dialog.__dict__['buttonList']
      YesBtn['extraArgs']=[dialog, 'Ok, Meneer']
      NoBtn['extraArgs']=[dialog, '1 dead "bug", pro-rsoft']

  def YesBtnClick(self,dialog,arg):
      print arg

  def NoBtnClick(self,dialog,arg):
      print arg

  def cleanUpDialog(self, dialog):

Oops, you’re right, that is a bug. ynjh_jo’s workaround should be fine. Note that you can also use PythonUtil.Functor to bind extra args up with any function object:

from direct.showbase.PythonUtil import Functor
dialog = DirectDialog(..., command = Functor(self.myCallback, myArg1, myArg2))