I want to get a message when every time I move the map.
I had:
def info(self):
QMessageBox.information( self, self.tr( "Info" ), self.tr("info") )
I suppose that used to be something like that...
iface.mapCanvas().???.connect(self.info)
I want to get a message when every time I move the map.
I had:
def info(self):
QMessageBox.information( self, self.tr( "Info" ), self.tr("info") )
I suppose that used to be something like that...
iface.mapCanvas().???.connect(self.info)
What you are looking for is the extentsChanged() signal. This is emitted every time, the map canvas is moved or zoomed.
The following code works from the python console:
from PyQt4.QtGui import QMessageBox
def info():
QMessageBox.information( iface.mapCanvas(), "Extents changed", "Pan or zoom occurred" )
iface.mapCanvas().extentsChanged.connect(info)
Adjusting it to be used from a a python object (like in a plugin) should be easy, the necessary self-parameters are in the question code already.
There is no information about the new extents emitted with the signal, but this can be easily queried with
iface.mapCanvas().extent()