My code wont work, is there some logical error here?

P

ProgramV

Guest
Can someone help me, Im trying to make a banking program and when i try to login and enter the correct details, it still says "notok". I put in some values for testing purposes and it just wont work and it would always print notok. Please help

import tkinter as tk
from tkinter import messagebox
import random


def checklog(ac,pin):
if (ac==1) and (pin==2):
print("ok")
else:
print("notok")



def exitwin(master):

master.destroy()



def acc_no(master):

acc_no.acc = random.randrange(1000000000,9999999999)

messagebox.showinfo("Account Number", acc_no.acc)
return

def openac():

op = tk.Tk()
op.title("Open a account")
op.minsize(500,500)
op.configure(bg='gray90')

l1 = tk.Label(op, text="Full Name")
l1.grid(row=0, column=2)

openac.name = tk.Entry(op)
openac.name.grid(row=0, column=3)

l2 = tk.Label(op, text="Enter Starting Deposit")
l2.grid(row=1, column=2)

openac.fun = tk.Entry(op)
openac.fun.grid(row=1, column=3)

l3 = tk.Label(op, text="Enter your pin")
l3.grid(row=2, column=2)

openac.pin = tk.Entry(op, show="*")
openac.pin.grid(row=2, column=3)

sub = tk.Button(op, text="Submit", command=lambda: [acc_no(op), login(), exitwin(op)])

sub.grid(row=3, column=1)

op.bind("<Return>", lambda x:[dep(op, e1.get(),e2.get(), e3.get()), acc_no(op), login(op, e1.get(), e2.get(), e3.get()), exitwin(op)])


return



def login():

log = tk.Tk()
log.title("Login")
log.minsize(500,500)

l1 = tk.Label(log, text="Enter your account number")
l1.grid(row=0, column=0)

e1 = tk.Entry(log)
e1.grid(row=0, column=1)

l2 = tk.Label(log, text="Enter your pin")
l2.grid(row=1, column=0)

e2 = tk.Entry(log)
e2.grid(row=1, column=1)

sub = tk.Button(log, text="Sumbit", command=lambda: checklog(e1.get(), e2.get()))
sub.grid(row=1, column=2)

return

log.mainloop()




def dep(master, name, fund, pin):
x=0



def draw():
x=0



def mainmenu():

mm = tk.Tk()
mm.title("Bank")
mm.minsize(400,400)
mm.configure(bg='gray70')


l1 = tk.Label(mm, text="HELLO")
l1.config(font=("Courier", "25"))
l1.grid(row=0)

b1 = tk.Button(mm, text="Sign Up", command=openac)
b1.grid(row=2)

b2 = tk.Button(mm, text="Log In", command=lambda: login(mm))
b2.grid(row=3)

mm.mainloop()

mainmenu()

Continue reading...
 
Top