parameters: (self,fn,multithreaded=True)
docstring: Saves a screenshot
docstring_summary: Saves a screenshot
docstring_tokens: Saves a screenshot
function: def save_screen(self,fn,multithreaded=True):
          """Saves a screenshot"""
          try:
              from PIL import Image
          except ImportError:
              try:
                  import Image
              except ImportError:
                  print "Cannot save screens to disk, the Python Imaging Library is not installed"
                  return
          if hasattr(self.window,'makeCurrent'):
              self.window.makeCurrent()
          glReadBuffer(GL_FRONT);
          x,y,w,h = self.view.x*self.view.screenDeviceScale,self.view.y*self.view.screenDeviceScale,self.view.w*self.view.screenDeviceScale,self.view.h*self.view.screenDeviceScale
          screenshot = glReadPixels( x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE)
          im = Image.frombuffer("RGBA", (w, h), screenshot, "raw", "RGBA", 0, 0)
          print "Saving screen to",fn
          if not multithreaded:
              im.save(fn)
          else:
              import threading
              def func(im,fn):
                  im.save(fn)
              th = threading.Thread(target=func,args=(im,fn))
              th.start()
function_tokens: def save_screen ( self , fn , multithreaded = True ) : try : from PIL import Image except ImportError : try : import Image except ImportError : print "Cannot save screens to disk, the Python Imaging Library is not installed" return if hasattr ( self . window , 'makeCurrent' ) : self . window . makeCurrent ( ) glReadBuffer ( GL_FRONT ) x , y , w , h = self . view . x * self . view . screenDeviceScale , self . view . y * self . view . screenDeviceScale , self . view . w * self . view . screenDeviceScale , self . view . h * self . view . screenDeviceScale screenshot = glReadPixels ( x , y , w , h , GL_RGBA , GL_UNSIGNED_BYTE ) im = Image . frombuffer ( "RGBA" , ( w , h ) , screenshot , "raw" , "RGBA" , 0 , 0 ) print "Saving screen to" , fn if not multithreaded : im . save ( fn ) else : import threading def func ( im , fn ) : im . save ( fn ) th = threading . Thread ( target = func , args = ( im , fn ) ) th . start ( )