does the 'window' match the variable you used in the line to define your window?
I had the problem where I said
win = create the window
when I needed to do
otherwise you might need to lowercase 'black'
Did you create a graphical window first with GraphWin()?
and then do your whateverYouNamedThisWindow.setBackground("black")