From Python console I load a shapefile with qgis.utils.iface.addVectorLayer. How I can remove border lines (change to no pen) in the active layer?
1 Answer
This assumes you are using the new symbology renderer (which is the default):
from PyQt4.QtCore import *
lyr = QgsVectorLayer('/data/world_borders.shp', 'world_borders', 'ogr')
QgsMapLayerRegistry.instance().addMapLayer(lyr)
renderer = lyr.rendererV2()
symbol = QgsFillSymbolV2.createSimple({QString('style'): QString('solid'), QString('color'): QString('255,0,0,255'), QString('style_border'):QString('no')})
renderer.setSymbol(symbol)
Then trigger a repaint for the layer and update the legend.