2

I want to zoom into the current active QGIS canvas from a standalone python script.

I tried the following but it doesn't impact the current QGIS canvas:

import qgis.utils
canvas = qgis.utils.iface.mapCanvas()
canvas.zoomIn()

Can I modify the QGIS app from a standalone python script (not from the QGIS Python console)? If so, how do I do that?

5
  • Purely a guess but perhaps try using from qgis.gui import QgsMapCanvas? Commented Jan 20, 2015 at 11:21
  • Doesn't do anything either. Commented Jan 20, 2015 at 12:32
  • what kind of standalone script? Something that inside a QGIS session? Commented Jan 20, 2015 at 12:53
  • I have a running QGIS session and independently from that a Python script (not the Python console). Commented Jan 20, 2015 at 12:56
  • 1
    Very similar question: gis.stackexchange.com/questions/77797/… Commented Jan 24, 2015 at 4:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.