[Tutor] Command not issued until after escape from loop

Alan Gauld alan.gauld at btinternet.com
Mon Mar 15 09:53:07 CET 2010


"David Hutto" <dwightdhutto at yahoo.com> wrote

Caveat: I know zero about Blender... but...

> When I execute the script, it shows my main window, then if I
> press the CKEY it's *supposed* to call the cleanSlate() function,
>
> My problem is, it doesn't execute cleanSlate() until I hit the
> ESCKEY, or the QKEY.
> ******************************************************************
> # defining the event handling list
> def ev(evt, val):
>      scn = Scene.getCurrent()
>      if evt == Draw.ESCKEY or evt == Draw.QKEY:
>               Draw.Exit()
>      elif not val:
>             return
>      elif evt == Draw.CKEY:
>            cleanSlate(scn)
>      else:
>           return


Can you insert debvug statements to display values?
If so I'd try printing the value of val. If it is "False" - ie empty - the
event function will exit before reaching your code.

Alternatively try moving your elif up above the test for not val.

See if that helps.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list