1CorrectUsername = surname[0:3] + firstname[0:3]
2
3loop = 'true'
4while (loop == 'true'):
5 username = input("Please enter your username: ")
6 if (username == CorrectUsername):
7 password = input("Please enter your password: ")
8 if (password == CorrectPassword):
9 print("Logged in successfully as ") + username
10 loop = 'false'
11 else:
12 print "Password incorrect!"
13 else:
14 print "Username incorrect!"
1username = input(' enter your username: ')
2if username == 'Put Your Username Here':#change this
3 print("checking username")
4 time.sleep(0.5)
5 print("username is right")
6 password = input(' type your password: ')
7 if password == 'Put Your Password Here':#change this
8 time.sleep(0.5)
9 else:
10 exit()
11else:
12 exit()
1from tkinter import *
2from functools import partial
3
4def validateLogin(username, password):
5 print("username entered :", username.get())
6 print("password entered :", password.get())
7 return
8
9#window
10tkWindow = Tk()
11tkWindow.geometry('400x150')
12tkWindow.title('Tkinter Login Form - pythonexamples.org')
13
14#username label and text entry box
15usernameLabel = Label(tkWindow, text="User Name").grid(row=0, column=0)
16username = StringVar()
17usernameEntry = Entry(tkWindow, textvariable=username).grid(row=0, column=1)
18
19#password label and password entry box
20passwordLabel = Label(tkWindow,text="Password").grid(row=1, column=0)
21password = StringVar()
22passwordEntry = Entry(tkWindow, textvariable=password, show='*').grid(row=1, column=1)
23
24validateLogin = partial(validateLogin, username, password)
25
26#login button
27loginButton = Button(tkWindow, text="Login", command=validateLogin).grid(row=4, column=0)
28
29tkWindow.mainloop()