This question already has an answer here:

I want to change the style of the polygon contained in the vector layer. Is there any API available?

(I can click the properties of the shapefile, then select the style and change the symbol properties, but I want to do this programmatically.)

I am using Python to customise QGIS.

marked as duplicate by underdark qgis Feb 18 at 18:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The documentation can be found here: http://www.qgis.org/pyqgis-cookbook/vector.html#appearance-symbology-of-vector-layers

I haven't tried it yet, so I cannot provide any further pointers but the code examples there look good to go.

  • when we try to access class 'QgsMarkerSymbolLayerV2' from the python console inside the QGIS , It showed me that 'class doesn't exist' I am using QGIS 1.7 – Vicky Nov 5 '11 at 10:26
  • Works for me (running 1.7.1): >>> QgsMarkerSymbolLayerV2 <class 'qgis.core.QgsMarkerSymbolLayerV2'> – underdark Nov 5 '11 at 11:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.