added some code to get grains.py to work in Win w spyder