Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter
- import time
- import datetime
- import random
- from random import randint
- #Functions needed for the program
- def login():
- Bank_DB_UI = tkinter.Tk()
- Bank_DB_UI.title("Zoyds Bank")
- Bank_DB_UI.geometry("600x600")
- Bank_DB_UI.wm_iconbitmap('favicon.ico')
- Bank_DB_UI.configure(background="#5a5a5a")
- time.sleep(3)
- username = entUsername.get()
- password = entPassword.get()
- #Subheading Labels
- lbluser_name = tkinter.Label(Bank_DB_UI, text=username, bg="white", width="600", anchor="nw")
- lblpass_word = tkinter.Label(Bank_DB_UI, text=password, bg="white", width="600", anchor="nw")
- DB_Name = tkinter.Label(Bank_DB_UI, text="ZFD Enterprise", bg="white", width="600", font=("Helvetica", 42), anchor="nw")
- labelheader1 = tkinter.Label(Bank_DB_UI, text="Username:", bg="white", width="600", anchor="nw")
- labelheader2 = tkinter.Label(Bank_DB_UI, text="Password:", bg="white", width="600", anchor="nw")
- #Empty labels to make empty space
- lble1 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
- lble2 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
- lble3 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
- lble4 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
- lble5 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
- #Packing Labels
- lble3.pack()
- DB_Name.pack()
- lble2.pack()
- labelheader1.pack()
- lbluser_name.pack()
- lble1.pack()
- labelheader2.pack()
- lblpass_word.pack()
- #Stage 2 >>> Adding Balance Label to the UI
- rng=randint(0,1000000)
- balance=+rng
- balance_Label2 = tkinter.Label(Bank_DB_UI, text=balance, bg="white", width="600", anchor="nw")
- balance_Label = tkinter.Label(Bank_DB_UI, text="Balance(£):", bg="white", width="600", anchor="nw")
- lble4.pack()
- balance_Label.pack()
- balance_Label2.pack()
- #Stage 3 >>> Assign a random 4 digit pin to this account.
- from functools import reduce
- pin = reduce(lambda a,b: 10*a+b, random.sample(range(10), 4))
- PIN_Label = tkinter.Label(Bank_DB_UI, text=pin, bg="white", width="600", anchor="nw")
- PIN_Label2 = tkinter.Label(Bank_DB_UI, text="Bank Pin:", bg="white", width="600", anchor="nw")
- lble5.pack()
- PIN_Label2.pack()
- PIN_Label.pack()
- #Loginpopup Funciton
- def loginpopup():
- popup = tkinter.Tk()
- popup.wm_title("!")
- label = tkinter.Label(popup, text="Successfully Logged In!")
- label.pack(side="top", fill="x", pady=10)
- B1 = tkinter.Button(popup, text="Enter", command = login)
- B1.pack()
- popup.mainloop()
- #Window Configuration
- window = tkinter.Tk()
- window.title("Zoyds Bank")
- window.geometry("600x600")
- window.wm_iconbitmap('favicon.ico')
- window.configure(background="#5a5a5a")
- #Please Login to Continue:
- lblInst = tkinter.Label(window, text="Please login to continue:", bg="#a1dbcd", font=("Helvetica", 16))
- #Widgets
- lblUsername = tkinter.Label(window, text="Username:", bg="white")
- entUsername = tkinter.Entry(window)
- lblPassword = tkinter.Label(window, text="Password:", bg="white")
- entPassword = tkinter.Entry(window)
- btn = tkinter.Button(window, text="Login", command=loginpopup)
- photo = tkinter.PhotoImage(file="quavo.gif")
- w = tkinter.Label(window, image=photo) #quavo picture
- #Space making widget
- lblempty = tkinter.Label(window, text="", bg="#5a5a5a")
- lble2 = tkinter.Label(window, text="", bg="#5a5a5a")
- lble3 = tkinter.Label(window, text="", bg="#5a5a5a")
- lble4 = tkinter.Label(window, text="", bg="#5a5a5a")
- #Packing Widgets into Window
- lblInst.pack()
- lblempty.pack()
- lblUsername.pack()
- entUsername.pack()
- lble2.pack()
- lblPassword.pack()
- entPassword.pack()
- lble3.pack()
- btn.pack()
- w.pack()
- window.mainloop()
Add Comment
Please, Sign In to add comment