from tkinter import * from tkinter import ttk

def login():
uname=username.get()
pwd=password.get()
if uname'' or pwd'':
message.set("fill the empty field!!!")
else:
if uname"nd" and pwd"nd":
message.set("Login success")
newpage()
login_screen.destroy()
else:
message.set("Wrong username or password!!!")

def newpage():
win=Tk()
win.geometry("300x250")
win.title("Welcome")
global amt
Label(win,width="300",text="Hello User",bg="magenta", fg="white", font=("Helvetica 12 bold ")).pack()
Label(win,width="300",text="Enter details for transaction",bg="magenta", fg="white", font=("Helvetica 12 bold ")).pack()
Label(win, text="Amount").place(x=20,y=60)
amt=Entry(win, textvariable=username).place(x=90,y=62)
Label(win, text="Send to ").place(x=20,y=80)
Entry(win, textvariable=amt).place(x=90,y=82)
Label(win, text="",textvariable=message).place(x=95,y=120)
Button(win, text="Send Amount", width=10, height=1, bg="green",command=hack).place(x=105,y=140)

def hack():
win = Tk()
win.geometry("300x250")
win.title("Hahahacked")
lab=Label(win,width="300",text="Amount Sent To Kermit H",bg="magenta", fg="white", font=("Helvetica 12 bold "))
lab.pack()
lab.after(2000, lambda: lab.config(text="!!!! You have been hacked !!!"))
lab.after(4000, lambda: lab.config(text="!!!! Have a Nice Day !!!"))
win.after(6000,lambda: win.destroy())

def Loginform():
global login_screen
login_screen = Tk()
login_screen.title("Login Form")
login_screen.geometry("300x250")
global message;
global username
global password
username = StringVar()
password = StringVar()
message=StringVar()
Label(login_screen,width="300", text="Please enter details below", bg="orange",fg="white").pack()
Label(login_screen, text="Username * ").place(x=20,y=40)
Entry(login_screen, textvariable=username).place(x=90,y=42)

1
2
3
4
5
6
Label(login_screen, text="Password * ").place(x=20,y=80)

Entry(login_screen, textvariable=password ,show="*").place(x=90,y=82)                                                              
Label(login_screen, text="",textvariable=message).place(x=95,y=100)
Button(login_screen, text="Login", width=10, height=1, bg="orange",command=login).place(x=105,y=130)
login_screen.mainloop()

Loginform()

Edit
Pub: 19 Mar 2023 17:45 UTC
Views: 12