def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_Form() self.ui.setupUi(self) self.fileDialog = QtGui.QFileDialog(self) self.ui.pushButton.clicked.connect(self.helloworld)
class MyForm(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_Form() self.ui.setupUi(self) self.fileDialog = QtGui.QFileDialog(self) self.ui.pushButton.clicked.connect(self.helloworld) def helloworld(self): filepath = str(QFileDialog.getOpenFileName()) print "Generating hex file for " , filepath # pixmap = QPixmap(filepath) # self.ui.label.setPixmap(pixmap) imgtool(filepath) pixmap = QPixmap("Greyscale.jpg") self.ui.label.setPixmap(pixmap)