Something I don't understand

Hi, when executing my script(or at least a test of the string-thing for gui in blender) i get a error: TypeError: buttonEvt() takes exactly 1 argument (2 given)
what does this error mean?

here is the code I’m trying to execute


from Blender import Draw, BGL

evtNoEvt = 0
evtString = 1

number = Draw.Create(0)
string = Draw.Create("Hello world!")

def gui():
  global evtNoEvt, evtString
  global string
  BGL.glRasterPos2i(10,350)
  Draw.Text("press Q or ESC to quit.")

  string = Draw.String("String: ", evtString, 10, 60, 160, 18, string.val, 20, "A string button")
  BGL.glRasterPos2i(200,65)
  if string.val:   
      Draw.Text('The filepath is "%s",' % string.val)
  else: Draw.Text("No file is chosen")

def buttonEvt(evt):
  global evtNoEvt, evtString
  global string
  if evt == evtString:
    print "the chosen file is now:", string.val
  elif evt == evtNoEvt:
    print "No event"
  if evt:
    Draw.Redraw()
    
Draw.Register(gui, buttonEvt) 

thanks, Bjørn

Try changing

def buttonEvt(evt):

to

def buttonEvt(evt, val):

.

See http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Advanced_Tutorials/Python_Scripting/Creating_a_GUI_for_your_script for reference.

It worked! thanks mate!