2

I am making a script that works with labels.

Is it possible to turn on/off the display of unplaced labels with PyQGIS?

enter image description here

1 Answer 1

3

One way to do it would be to 'click' the button using PyQGIS:

for child in iface.mainWindow().children():
    if child.objectName() == 'mActionShowUnplacedLabels':
        child.trigger()
        break

You can get its current state with:

child.isChecked()

enter image description here False

enter image description here True

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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