Improve tvtk import 

This fix checks the import of tvtk and configures it for headless operation.

And some PEP8 formatting fixes