I have a QGIS project and in that project there is a print composer layout titled mainmap. This print composer layout has my desired layout items like a title, scalebar, and legend. mainmap also has a map with the default name Map 1.
I can use the Python code below in the Python Console to move the extent of the project canvas to the extent of the QgsRectangle just fine.
rect = QgsRectangle(1196381.0,655556.0,1204217.0,660632.0)
canvas = qgis.utils.iface.mapCanvas()
I would now like to use Python to also change the extent of mainmap/Map 1 in the print composer to the same QgsRectangle referenced in the code above. I can see the Extent settings in the Item Properties (see the image below) and I can set them manually. What Python code would I do to set the extents of Map 1 to match the map canvas?