Issue
How to get values returned from the QDialog box to the another funtion.Here below code i want to get value of x_value in ValueRequiredFuntion() from x_value of the ValueInput().
#inside __init__()
self.ui.pushButton.clicked.connect(self.ValueInput)
def ValueInput(self):
x_value, ok = QInputDialog.getDouble(self, "Change X Value","Enter the New Value", 0.0,0, 100, )
def ValueRequiredFuntion(self):
#How to get x_value here.
Solution
You can use self.
to have access to variable in all methods
def ValueInput(self):
self.x_value, ok = QInputDialog.getDouble(...)
def ValueRequiredFuntion(self):
print(self.x_value)
But you could also send it as argument if you will run it directly after you close dialog.
def ValueInput(self):
x_value, ok = QInputDialog.getDouble(...)
self.ValueRequiredFuntion(x_value)
def ValueRequiredFuntion(self, value):
print(value)
Answered By - furas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.