I use QGIS and I want to work with custom forms using python logic and I try to follow this manual. In my custom qu I add one new pushButton and I want for example for educations rules to open some image. But that dont work dont show me anything,any idea where I have wrong in my python code ?

Here the python code :

from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os
from PyQt4.QtGui import QWidget

nameField = None
myDialog = None
def my_form_open(dialog, layer, feature):
    geom = feature.geometry()
    control = dialog.findChild(QWidget, "MyLineEdit")
    global myDialog
    myDialog = dialog
    global nameField
    nameField = dialog.findChild(QLineEdit,"Name")
    buttonBox = dialog.findChild(QDialogButtonBox,"buttonBox")
    pushButton = dialog.findChild(QPushButton,"pushButton")

    # Disconnect the signal that QGIS has wired up for the dialog to the button box.

    # Wire up our own signals.

def validate():

1 Answer 1


I think you want to use pushButton.clicked rather and pushButton.accepted.

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.