0

I am trying to add Maccept method to the ImageDialog class and connect this to okButton. However when I compile this code it will give : AttributeError: 'ImageDialog' object has no attribute 'Maccept' But I have already defined Maccept method inside the class.

from PyQt5.QtWidgets import QDialog,QApplication
from ui_imagedialog import Ui_ImageDialog
import sys
class ImageDialog(QDialog):
def __init__(self):
    super(ImageDialog, self).__init__()

    # Set up the user interface from Designer.
    self.ui = Ui_ImageDialog()
    self.ui.setupUi(self)
    # Make some local modifications.
    #self.ui.colorDepthCombo.addItem("2 colors (1 bit per pixel)")

    # Connect up the buttons.
    self.ui.okButton.clicked.connect(self.Maccept())

    self.ui.cancelButton.clicked.connect(self.reject)
    def Maccept(self):
            print 'accept'

def main():
            app=QApplication(sys.argv)
            window=ImageDialog()
            window.show()
            sys.exit(app.exec_())
if __name__=='__main__':
            main()
dundar yilmaz
  • 141
  • 1
  • 6
  • it was a stupid mistake. i am using vi as an editor and it has auto indent feature apparently puts a tab character for the indentation. I replaced with 4xspace character and solved. – dundar yilmaz May 08 '17 at 19:14

1 Answers1

0

it was a stupid mistake. i am using vi as an editor and it has auto indent feature apparently puts a tab character for the indentation. I replaced with 4xspace character and solved.

dundar yilmaz
  • 141
  • 1
  • 6