2

I want script in python3 with QGIS 3?

For example:

This code create a layout 2019_A4 and add Layout Manager. I need a code make same in QGIS3 using QgsLayoutManager with Methods duplicateLayout

Here: https://qgis.org/pyqgis/3.4/core/QgsLayoutManager.html

from qgis.PyQt.QtCore import *
from qgis.core import *

# A Project, Manager, & PrintLayout Classes
project = QgsProject.instance()
manager = project.layoutManager()
# layout = QgsPrintLayout(project)
layout = manager.layoutByName("2019_A4")
#layout.initializeDefaults()
#layout.setName('2019_A')
manager.addLayout(layout)
1

With just this line of code, it's working fine for me :

layout_bis = manager.duplicateLayout(layout, '2019_A_bis')

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.