Hey,
I am new to PyQT4.
After some tuts I decided to make a simple GUI in which I will enter text in first line and on clicking of Reverse button ,it will show reversed string on second line.
I made a custom slot for this,by defining the function in my class.But when I click reverse nothing happens. I have used in-bilt slots for Clear button and Exit button in my GUI and they are working perfectly.
If someone can just clarify this custom slot problem it would help me advance further.
Thanks in advance.
Here's a photo of my GUI
http://img196.imageshack.us/img196/7131/diall.png
Stringreverse.py Final File
import sys
from PyQt4 import QtCore, QtGui
from stringreverse_ui import Ui_Dialog
class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui=Ui_Dialog()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton_3,QtCore.SIGNAL("Click()"), self.reverse)
def reverse(self):
s=self.ui.lineEdit_2.text()
self.ui.lineEdit.setText(s[::-1])
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = MyForm()
myapp.show()
sys.exit(app.exec_())enter code here