def renderSymbol(symbol, size, pen, brush, device=None):
 penPxWidth = max(np.ceil(pen.widthF()), 1)
 if (device is None):
  device = QtGui.QImage(int((size + penPxWidth)), int((size + penPxWidth)), QtGui.QImage.Format_ARGB32)
  device.fill(0)
 p = QtGui.QPainter(device)
 try:
  p.setRenderHint(p.Antialiasing)
  p.translate((device.width() * 0.5), (device.height() * 0.5))
  drawSymbol(p, symbol, size, pen, brush)
 finally:
  p.end()
 return device

def renderSymbol ( symbol , size , pen , brush , device = None ) : penPxWidth = max ( np . ceil ( pen . widthF ( ) ) , 1 ) if ( device is None ) : device = QtGui . QImage ( int ( ( size + penPxWidth ) ) , int ( ( size + penPxWidth ) ) , QtGui . QImage . Format_ARGB32 ) device . fill ( 0 ) p = QtGui . QPainter ( device ) try : p . setRenderHint ( p . Antialiasing ) p . translate ( ( device . width ( ) * 0.5 ) , ( device . height ( ) * 0.5 ) ) drawSymbol ( p , symbol , size , pen , brush ) finally : p . end ( ) return device
render a symbol specification to qimage .