Thursday 3 October 2019

pyqgis - How to read out which map theme is used in QGIS 3


I'm using QGIS 3.2.2 and Python. I would like to read out which map theme I currently use.


enter image description here


I know the following method provides me a list of defined map themes ('Theme1', 'Theme2'):


QgsProject.instance().mapThemeCollection().mapThemes() 

I don't know any method which provides me with the map theme name used itself.


I tried to use iface.mapCanvas().theme() but it always returns an empty string.





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...