Mike Sr
Mike Sr

Reputation: 1

I am trying to get a push button from QT Designer to print something when I push the button

Keep getting an error when I run my code

I have changed this many different times trying different things. I had this working a couple of days ago. I lost the program I was using and can't remember how it was put together.

class Gui(QtGui.QMainWindow, ui_hayfeeder.Ui_MainWindow):    
    def __init__(self):        
        super(self.__class__, self).__init__()  
        self.exiting = True
        self.setupUi(self) 
        self.startup()
        #self.pushButton_c_update.clicked.connect(self.update_clients)
        self.pushbutton_bale1.clicked.connect(self.bale1)

    def self.pushbutton_bale1 #getting error here


        print "I am in here"

Print "I am in here"

Upvotes: 0

Views: 237

Answers (1)

HuLu ViCa
HuLu ViCa

Reputation: 5452

It should be something like this:

class Gui(QtGui.QMainWindow, ui_hayfeeder.Ui_MainWindow):    
    def __init__(self):        
        super(self.__class__, self).__init__()  
        self.exiting = True
        self.setupUi(self) 
        self.startup()
        #self.pushButton_c_update.clicked.connect(self.update_clients)
        self.pushbutton_bale1.clicked.connect(self.bale1)

    def bale1(self):
        print "I am in here"

Upvotes: 1

Related Questions