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 window.setBackground
when I needed to do
win.setBackground()
otherwise you might need to lowercase 'black'
Did you create a graphical window first with GraphWin()?
and then do your whateverYouNamedThisWindow.setBackground("black")