no copy of maya in front of me but as far as I know the window stuff is the same.
Try it outside of the function and see if that works, maybe it needs this stuff to be global (but that's unlikely). Just to check, you are calling the function once you've written right? (Sorry i just want to check every possibility! )
Alan
Technical Director - Framestore
Currently working on: Your Highness
IMDB