View Single Post
Posts: 18 | Thanked: 2 times | Joined on Aug 2010
#1
I have been messing around with pyqt but i have hit a brick wall with this.

Basically, i used the designer to create a gui and the main code is the program, but i keep getting an attribute error when i try and make a function for some buton.

Code:
#!/usr/bin/python2.5
import sys
from PyQt4 import QtGui,QtCore
from sms_ui import *

class Awesome(QtGui.QMainWindow):
        def __init__(self, parent=None):
                #build parent user interface
                QtGui.QWidget.__init__(self, parent)
                self.ui = Ui_MainWindow()
                self.ui.setupUi(self)
                QtCore.QObject.connect(self.ui.btnSend, QtCore.SIGNAL('clicked()'), self.smsgo)

		def smsgo(self):
				a=1

if __name__ == "__main__":
        #This function means this was run directly, not called from another python file.
        app = QtGui.QApplication(sys.argv)
        myapp = Awesome()
        myapp.show()
        sys.exit(app.exec_())
I cant see what is wrong here. if i remove

Code:
QtCore.QObject.connect(self.ui.btnSend, QtCore.SIGNAL('clicked()'), self.smsgo)

		def smsgo(self):
				a=1
The GUI is fine. I have double checked the names of everything.

Any insight?