mishra.rakesh510
31st January 2014, 08:59
here is my code..
import sys
from PySide import QtGui
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.btn = QtGui.QPushButton('Dialog', self)
self.btn.move(20, 20)
self.btn.clicked.connect(self.showDialog)
self.le = QtGui.QLineEdit(self)
self.le.move(130, 22)
self.setGeometry(300, 300, 290, 150)
self.setWindowTitle('Input dialog')
self.show()
def showDialog(self):
dialog=QtGui.QInputDialog()
#dialog.setComboBoxItems(["a",'b','bcd'])
#dialog.textValueChanged.connect(self.fun)
dialog.setLabelText("asdasd")
dialog.show()
dialog.textValueChanged.connect(self.fun)
text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')
if ok:
self.le.setText(str(text))
def fun(self,name):
print "fun is callling",name
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
but it creates two dialog boxes one is from dialog=QtGui.QInputDialog()
and another one comes from
text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')
i want to create a dialogbox and has a "textValueChanged" signal whenver text change it call fun slot and once i pressed on button it should
save in text, ok variable
Could u please help me to find the solution
Thanks in advance
Rakesh
import sys
from PySide import QtGui
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.btn = QtGui.QPushButton('Dialog', self)
self.btn.move(20, 20)
self.btn.clicked.connect(self.showDialog)
self.le = QtGui.QLineEdit(self)
self.le.move(130, 22)
self.setGeometry(300, 300, 290, 150)
self.setWindowTitle('Input dialog')
self.show()
def showDialog(self):
dialog=QtGui.QInputDialog()
#dialog.setComboBoxItems(["a",'b','bcd'])
#dialog.textValueChanged.connect(self.fun)
dialog.setLabelText("asdasd")
dialog.show()
dialog.textValueChanged.connect(self.fun)
text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')
if ok:
self.le.setText(str(text))
def fun(self,name):
print "fun is callling",name
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
but it creates two dialog boxes one is from dialog=QtGui.QInputDialog()
and another one comes from
text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')
i want to create a dialogbox and has a "textValueChanged" signal whenver text change it call fun slot and once i pressed on button it should
save in text, ok variable
Could u please help me to find the solution
Thanks in advance
Rakesh