Created
September 30, 2019 08:41
-
-
Save Divyanbhard29/2f4ed7f810ed728cf3c5cc8d64eca7e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
import csv #missing | |
from tkinter import messagebox | |
#configure tk window | |
t=Tk() | |
t.title("Banking") | |
t.geometry("500x500+500+100") | |
#set them to stringvar() | |
pas=StringVar() | |
un = StringVar() | |
lname = StringVar() | |
fname = StringVar() | |
#This where all function defines | |
def f_write(path): | |
f1=open("database.csv","a") | |
f1.write(path) | |
f1.close() | |
def un_data(un,dv): | |
f2=open(un+"1.csv","a") | |
f2.write(dv) | |
f2.close() | |
def f_read(bun,key=0): | |
f22=open(bun+"1.csv","r") | |
databas=f22.readlines() | |
if key==1: | |
return databas | |
for row in databas: | |
row=row.split(",") | |
bcd=row[2] | |
bcd=eval(bcd) | |
f22.close() | |
return bcd | |
def ssymbol(password): | |
b=['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@'] | |
for i in password: | |
for j in b: | |
if i==j: | |
return 1 | |
def ucase(password): | |
b=password.upper() | |
for i in password: | |
for j in b: | |
if i==j: | |
return 1 | |
def nnatural(password): | |
for i in range(49,58): | |
for j in password: | |
if chr(i)==j: | |
return 1 | |
def password1(fname,lname,un,password,key): #while causing loop that freeze button | |
try: | |
if (len(password))>8: | |
fname = a | |
lname = b | |
un = c | |
pas = d | |
if a==b==c==d==1: | |
print("password saved") | |
elif key != 1: | |
password=input("password not secure\nenter password again") | |
sum=a+b+c | |
path=(fname+","+lname+","+un+","+password+","+"\n") | |
f_write(path) | |
elif key==1: | |
credit="0" | |
debit="0" | |
balance="1000" | |
dv=credit+","+debit+","+balance+"\n" | |
un_data(un,dv) | |
print("Signup Succussfully") | |
else: | |
password=input("string should be more than 8 character\nenter password again") | |
except: | |
messagebox.warning("Wait","You did something wrong here,Try again") | |
def signup(): | |
#signup window | |
sn=Tk() | |
sn.title("Signup") | |
sn.geometry("500x500+500+100") | |
#label | |
label=Label(sn,text="Enter your First name") | |
label.place(x=50,y=50) | |
text=Entry(sn,textvariable=fname) | |
text.place(x=200,y=50) | |
label1=Label(sn,text="Enter your last name") | |
label1.place(x=50,y=100) | |
text1=Entry(sn,textvariable=lname) | |
text1.place(x=200,y=100) | |
label2=Label(sn,text="Enter your Username") | |
label2.place(x=50,y=150) | |
text2=Entry(sn,textvariable=un) | |
text2.place(x=200,y=150) | |
label3=Label(sn,text="Enter your password") | |
label3.place(x=50,y=200) | |
text3=Entry(sn,textvariable=pas) | |
text3.place(x=200,y=200) | |
button=Button(sn,text='check password and save',command=saved) #password1(str(fname),str(lname),str(un),str(pas),key=1) | |
button.place(x=50,y=300) | |
sn.mainloop() | |
def saved(): | |
## fname.delete('0',END) | |
## fname.update() | |
## lname.delete('0',END) | |
## lname.update() | |
## pas.delete('0',END) | |
## pas.update() | |
## un.delete('0',END) | |
## un.update() | |
messagebox.showinfo("Done","You complete this process") | |
## with open('person.csv', 'w') as csvFile: | |
## writer = csv.writer(csvFile) | |
## writer.writerows([text]) | |
## writer.writerows([text1]) | |
## writer.writerows([text2]) | |
## writer.writerows([text3]) | |
t.destroy() | |
def login(): | |
t.destroy() #destroy window | |
button=Button(text='Signup',command=signup).pack() | |
button=Button(text='login',command=login).pack() | |
t.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment