def deg2pix(degrees, monitor, correctFlat=False):
 scrWidthCm = monitor.getWidth()
 scrSizePix = monitor.getSizePix()
 if (scrSizePix is None):
  msg = 'Monitor %s has no known size in pixels (SEE MONITOR CENTER)'
  raise ValueError((msg % monitor.name))
 if (scrWidthCm is None):
  msg = 'Monitor %s has no known width in cm (SEE MONITOR CENTER)'
  raise ValueError((msg % monitor.name))
 cmSize = deg2cm(degrees, monitor, correctFlat)
 return ((cmSize * scrSizePix[0]) / float(scrWidthCm))

def deg2pix ( degrees , monitor , correctFlat = False ) : scrWidthCm = monitor . getWidth ( ) scrSizePix = monitor . getSizePix ( ) if ( scrSizePix is None ) : msg = 'Monitor %s has no known size in pixels (SEE MONITOR CENTER)' raise ValueError ( ( msg % monitor . name ) ) if ( scrWidthCm is None ) : msg = 'Monitor %s has no known width in cm (SEE MONITOR CENTER)' raise ValueError ( ( msg % monitor . name ) ) cmSize = deg2cm ( degrees , monitor , correctFlat ) return ( ( cmSize * scrSizePix [ 0 ] ) / float ( scrWidthCm ) )
convert size in degrees to size in pixels for a given monitor object .