How can I pan my map on Qgis with left mouse button programmatically ? I see the desktop application do this, so no mouse middle button !

  • Gradual panning over time, or instantaneously pan to a specific location?
    – Matt
    Commented Nov 11, 2022 at 15:23
  • Qgis uses wheel button press, to do pan, I want to press left button instead using python code.
    – Gab74
    Commented Nov 11, 2022 at 15:26

1 Answer 1


You can 'click' the Pan button like so:

for child in iface.mainWindow().children():
    if child.objectName() == 'mActionPan':

This will activate the panning tool, which responds to the left mouse button.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.