I am trying to change programmatically using python the grid on the map composer of QGIS.
Does anyone knows the syntax for this operation?
The only solution I have found is to dynamically modify the xml of the composer using the following code.
from xml.etree.ElementTree import ElementTree tree = ElementTree() p = tree.parse("...\\print2.qpt") for node in p.findall('Composition/ComposerMap/ComposerMapGrid'): if node.attrib['intervalX']: node.set('intervalX','ValueOfX) if node.attrib['intervalY']: node.set('intervalY', 'ValueOfY') tree.write("..\print2.qpt")`