Hi, does https://github.com/mach0/qchainage/blob/master/chainagetool.py
line 150 ff help you? regards Werner On Wed, Apr 1, 2015 at 1:25 PM, Casper Børgesen (CABO) <c...@niras.dk> wrote: > I’m trying to programmatically set and enable labelling on a layer using > Python in QGis 2.9.0. > > > > label = QgsPalLayerSettings() > > label.readFromLayer(myLayer) > > > > label.enabled = True > > label.fieldName = 'myField' > > > > # Just to change something clearly visible. > > label.textColor = QColor(255,0,0,255) > > > > label.writeToLayer(myLayer) > > > > This doesn’t enable labelling, but if I enter the Layer Properties on > myLayer, everything looks okay and when pressing Apply, the labels become > visible. > > > > Is there something I need to set to avoid having to manually click Apply to > get the labels visible? > > > > Calling iface.mapCanvas().refresh() afterwards doesn’t work. > > > > > > Regards, Casper > > > _______________________________________________ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user