I have a text box which takes in user input and checks to see if the input is correct. If the input is not correct, I made a dialog box to ask the user to enter the information again with a count stating the number of tries left. However the dialog box keeps counting down and does not allow the user to enter any data.
def OnClick2(self,event):
password=self.enteredPass.GetValue() #takes the password form the textbox
user=self.enteredUser.GetValue() #takes the username form the textbox
count=0 # count for the number of tries
while (user!="Username" and password!="Password"): #loops untill it is right
dlg=wx.MessageDialog(self,"You have %s tries left"%(str(3-count)),"",wx.OK)
dlg.ShowModal()
dlg.Destroy()
count=count+1
password=self.enteredPass.GetValue() #retakes the password
user=self.enteredUser.GetValue() #retakes the username
if (count==3):
self.Destroy()
break
how can I make it so the loop pauses until the user re-enters the user and password, then continues again?