1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #login.py from tkinter import * from tkinter import messagebox def login(): uname = e1.get() password = e2.get() if (uname = = " " and password == " ") : messagebox.showinfo(" ", " Blank Not allowed") elif (uname = = "cairocoders" and password = = "123456" ): messagebox.showinfo(" "," Login Success") root.destroy() else : messagebox.showinfo(" "," Incorrent Username and Password") root = Tk() root.title( "Login" ) root.geometry( "400x200" ) global e1 global e2 Label(root, text = "Login form using Python Tkinter" ).place(x = 5 , y = 10 ) Label(root, text = "UserName" ).place(x = 10 , y = 40 ) Label(root, text = "Password" ).place(x = 10 , y = 60 ) e1 = Entry(root) e1.place(x = 140 , y = 40 ) e2 = Entry(root) e2.place(x = 140 , y = 60 ) e2.config(show = "*" ) Button(root, text = "Login" , command = login ,height = 2 , width = 13 ).place(x = 10 , y = 100 ) root.mainloop() |
article
Saturday, August 27, 2022
Python Tkinter Simple Login form
Python Tkinter Simple Login form