I have an application in which I tried using a while loop but the application just hangs, and now I think I need to use QEventLoop to make the application work here is some of the relevant code
def ex_initialator(self):
""" sets up things for the problem runner """
print "ayadara"
print "self.start_button_status this is...::" ,self.start_button_status
#:Pop up dialogs
no_options_selected = QtGui.QMessageBox()
select_range = QtGui.QMessageBox()
select_op_type = QtGui.QMessageBox()
#:Shows message if no options selected
if len(self.op_types) < 1 and len(self.num_range) < 1 and self.start_button_status == 0:
print "Please pick from the options provided"
no_options_selected.exec_()
#:Shows message if range is not selected
if len(self.op_types) >= 1 and len(self.num_range) < 1 and self.start_button_status == 0 :
print "Please pick at least one of the ranges"
select_range.exec_()
#:Shows message if op_type/s not selected
if len(self.op_types) < 1 and len(self.num_range) >= 1 and self.start_button_status == 0:
print "Please pick at least one of the operation types"
select_op_type.exec_()
#:Correct inputs initiates problem maker
if len(self.op_types) >= 1 and len(self.num_range) >= 1 and (self.start_button_status == 0 or self.start_button_status == 1):
self.start_button_status = 1
self.prob_signal.runner_sig.connect(self.problem_runner)
self.prob_signal.runner_sig.emit()
def problem_runner(self):
""" Expression Makers """
while self.start_button_status == 1:
#:picks range types
range_type = random.choice(self.num_range)
D = decimal.Decimal
self.answer_lineEdit.returnPressed.connect(self.ex_evaluator)
self.answer_lineEdit.clear()
what I want is to be able to start, pause, and stop buttons, I'm a beginner so I might have gone wrong in using QLineEdit in which case I would appreciate some suggestions as to a better implementation