Using 3.10.1-A Coruña on Windows 10
I am writing a Python Script in the QGIS Editor but iface.mapCanvas().zoomToSelected()
does not appear to be working at all in the Editor.
iface.mapCanvas().zoomToSelected()
- works fine in the Python Console
Editor code - apparently does nothing
selectid = [2]
poalayer.select(selectid)
iface.mapCanvas().zoomToSelected() # does nothing
iface.mapCanvas().refresh();
Console - works as expected
iface.mapCanvas().zoomToSelected()
Let me know if I can provide any further info or do a test.
Added additional info: There's something obviously wrong here. From this reply (QGIS: Zoom to selected feature via plugin doesn't works in first attempt) I tried running my script a second time in the same session and it worked.