Hi, this is my code for Python:
granted = False
for count in range(10):
password = raw_input('Please enter a password: ')
if password == 'thepassword':
granted = True
break
print 'You have entered invalid password %i times.' % (count+1)
if granted:
print 'Access Granted'
raw_input('Press ENTER to continue...\n')
else:
print 'Access Denied. Please retry.'
raw_input('Press ENTER to continue...\n')
I want to use a GUI like this:
import wx
class mainclass(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Password Program', size=(300,300))
panel=wx.Panel(self)
box=wx.TextEntryDialog(None, 'Please type your password:','Password')
if box.ShowModal()==wx.ID_OK:
answer=box.GetValue()
if __name__=='__main__':
app=wx.PySimpleApp()
frame=mikey(parent=None,id=-1)
frame.Show()
app.MainLoop()
If you try the second code, it will pop up a password box, then when you press OK it will close and the main program window will open.
I want it so when you type the correct password, the main program window opens, and if not, the 'retry' text shows.
Help?