Le 14/03/17 à 20:56, Xristos Xristoou a écrit :
i will want to create a simple python script with pyqt4 and Q designer where
the user put a number (line_edit) and if that number is something the user take
back three new codes(lineEdit_2,lineEdit_3,lineEdit_4) and if user press
ok(buttonBox) then plugin do something else in the some GUI.
for that i create a new additional pushButton in Qdesigner and i create
additional def function(run1) for execute code for pushButton.
first i add new pushbutton in __init__ :
def __init__(self, iface):
self.dlg = pluginDialog()
self.dlg.pushButton.clicked.connect(self.run1)
plugin work without error but dont show me the codes
(lineEdit_2,lineEdit_3,lineEdit_4) in the plugin window if i press
pushbutton
any idea ? my python code :
def run1(self):
distance = str(self.dlg.lineEdit.text())
if distance==0:
area1='some'
area2='hello'
area3='world'
self.dlg.lineEdit_2.setText(str(area1))
self.dlg.lineEdit_3.setText(str(area2))
self.dlg.lineEdit_4.setText(str(area3))
def run(self):
self.dlg.show()
result = self.dlg.exec_()
if result:
pass
and i try to replace run1 with :
def run1(self):
self.dlg.show()
result = self.dlg.exec_()
if result:
distance = str(self.dlg.lineEdit.text())
if distance==0:
area1='some'
area2='hello'
area3='world'
self.dlg.lineEdit_2.setText(str(area1))
self.dlg.lineEdit_3.setText(str(area2))
self.dlg.lineEdit_4.setText(str(area3))
pass
but no change.
distance is a string, then you have to compare it with the string "0"
not the integer
Vincent
--
https://mail.python.org/mailman/listinfo/python-list