TransWikia.com

Set fill transparency at 0% but keep line at 100% PyQGIS

Geographic Information Systems Asked by cam_gis on July 27, 2021

I am trying to make the color of my buffer totally transparent, but I want to keep the stroke fully colored.

I tried the following :

color1 = QtGui.QColor('#f3a6b2') #or whatever, as it will be transparent
color2 = QtGui.QColor('#ffffff')
symbo = QgsSimpleFillSymbolLayer(color = color1, strokeColor = color2, strokeWidth = 1.26)
buffer_loc.setOpacity(0)
buffer_loc.renderer().symbol().changeSymbolLayer(0, symbo)
buffer_loc.triggerRepaint()

But the opacity applies to the whole polygon, including the stroke.
Any tips ? I only found answers regarding rasters but nothing for vector layers so far…

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP