Guest User

Quavo Bank Account

a guest
May 30th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. import tkinter
  2. import time
  3. import datetime
  4. import random
  5. from random import randint
  6.  
  7. #Functions needed for the program
  8. def login():
  9. Bank_DB_UI = tkinter.Tk()
  10. Bank_DB_UI.title("Zoyds Bank")
  11. Bank_DB_UI.geometry("600x600")
  12. Bank_DB_UI.wm_iconbitmap('favicon.ico')
  13. Bank_DB_UI.configure(background="#5a5a5a")
  14. time.sleep(3)
  15. username = entUsername.get()
  16. password = entPassword.get()
  17.  
  18. #Subheading Labels
  19. lbluser_name = tkinter.Label(Bank_DB_UI, text=username, bg="white", width="600", anchor="nw")
  20. lblpass_word = tkinter.Label(Bank_DB_UI, text=password, bg="white", width="600", anchor="nw")
  21. DB_Name = tkinter.Label(Bank_DB_UI, text="ZFD Enterprise", bg="white", width="600", font=("Helvetica", 42), anchor="nw")
  22. labelheader1 = tkinter.Label(Bank_DB_UI, text="Username:", bg="white", width="600", anchor="nw")
  23. labelheader2 = tkinter.Label(Bank_DB_UI, text="Password:", bg="white", width="600", anchor="nw")
  24.  
  25. #Empty labels to make empty space
  26. lble1 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
  27. lble2 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
  28. lble3 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
  29. lble4 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
  30. lble5 = tkinter.Label(Bank_DB_UI, text="", bg="#5a5a5a")
  31.  
  32. #Packing Labels
  33. lble3.pack()
  34. DB_Name.pack()
  35. lble2.pack()
  36. labelheader1.pack()
  37. lbluser_name.pack()
  38. lble1.pack()
  39. labelheader2.pack()
  40. lblpass_word.pack()
  41.  
  42. #Stage 2 >>> Adding Balance Label to the UI
  43. rng=randint(0,1000000)
  44. balance=+rng
  45.  
  46. balance_Label2 = tkinter.Label(Bank_DB_UI, text=balance, bg="white", width="600", anchor="nw")
  47. balance_Label = tkinter.Label(Bank_DB_UI, text="Balance(£):", bg="white", width="600", anchor="nw")
  48.  
  49. lble4.pack()
  50.  
  51. balance_Label.pack()
  52. balance_Label2.pack()
  53.  
  54. #Stage 3 >>> Assign a random 4 digit pin to this account.
  55. from functools import reduce
  56. pin = reduce(lambda a,b: 10*a+b, random.sample(range(10), 4))
  57.  
  58. PIN_Label = tkinter.Label(Bank_DB_UI, text=pin, bg="white", width="600", anchor="nw")
  59. PIN_Label2 = tkinter.Label(Bank_DB_UI, text="Bank Pin:", bg="white", width="600", anchor="nw")
  60.  
  61. lble5.pack()
  62.  
  63. PIN_Label2.pack()
  64. PIN_Label.pack()
  65.  
  66. #Loginpopup Funciton
  67. def loginpopup():
  68. popup = tkinter.Tk()
  69. popup.wm_title("!")
  70. label = tkinter.Label(popup, text="Successfully Logged In!")
  71. label.pack(side="top", fill="x", pady=10)
  72. B1 = tkinter.Button(popup, text="Enter", command = login)
  73. B1.pack()
  74. popup.mainloop()
  75.  
  76.  
  77. #Window Configuration
  78. window = tkinter.Tk()
  79. window.title("Zoyds Bank")
  80. window.geometry("600x600")
  81. window.wm_iconbitmap('favicon.ico')
  82. window.configure(background="#5a5a5a")
  83.  
  84. #Please Login to Continue:
  85. lblInst = tkinter.Label(window, text="Please login to continue:", bg="#a1dbcd", font=("Helvetica", 16))
  86.  
  87. #Widgets
  88. lblUsername = tkinter.Label(window, text="Username:", bg="white")
  89. entUsername = tkinter.Entry(window)
  90.  
  91. lblPassword = tkinter.Label(window, text="Password:", bg="white")
  92. entPassword = tkinter.Entry(window)
  93.  
  94. btn = tkinter.Button(window, text="Login", command=loginpopup)
  95.  
  96. photo = tkinter.PhotoImage(file="quavo.gif")
  97. w = tkinter.Label(window, image=photo) #quavo picture
  98.  
  99. #Space making widget
  100. lblempty = tkinter.Label(window, text="", bg="#5a5a5a")
  101. lble2 = tkinter.Label(window, text="", bg="#5a5a5a")
  102. lble3 = tkinter.Label(window, text="", bg="#5a5a5a")
  103. lble4 = tkinter.Label(window, text="", bg="#5a5a5a")
  104.  
  105.  
  106.  
  107. #Packing Widgets into Window
  108. lblInst.pack()
  109.  
  110. lblempty.pack()
  111.  
  112. lblUsername.pack()
  113. entUsername.pack()
  114.  
  115. lble2.pack()
  116.  
  117. lblPassword.pack()
  118. entPassword.pack()
  119.  
  120. lble3.pack()
  121.  
  122. btn.pack()
  123. w.pack()
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. window.mainloop()
Add Comment
Please, Sign In to add comment