I want to get a message when every time I move the map.
def info(self): QMessageBox.information( self, self.tr( "Info" ), self.tr("info") )
I suppose that used to be something like that...
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
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