Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cancelLogin(self):
- msg=messagebox.askyesno("login","Are you Sure?")
- if(msg):
- exit()
- def save_info(self):
- m=0
- **userid_info=self.txtuser.get();
- password_info=self.txtpassword.get();**
- lines=[]
- with open ("C:\Users\501446\Downloads\user.txt", 'rt') as in_file:
- for line in in_file:
- lines.append(line)
- if(userid_info==line or password_info==line):
- m+=1
- if(m==2):
- gh=messagebox.showinfo("login","login is succesful")
- exit()
- else:
- gh=messagebox.showinfo("Error","check your password")
- def __init__(self, top=None):
- '''This class configures and populates the toplevel window.
- top is the toplevel containing window.'''
- _bgcolor = '#d9d9d9'
- _fgcolor = '#000000'
- _compcolor = '#d9d9d9'
- _ana1color = '#d9d9d9'
- _ana2color = '#d9d9d9'
- top.geometry("632x360+781+199")
- top.title("LOGIN page")
- top.configure(background="darkgrey")
- top.configure(highlightbackground="#d9d9d9")
- top.configure(highlightcolor="black")
- self.label1 = Label(top)
- self.label1.place(relx=0.222, rely=0.25, height=26, width=54)
- self.label1.configure(activebackground="#f9f9f9")
- self.label1.configure(activeforeground="black")
- self.label1.configure(background="white")
- self.label1.configure(disabledforeground="#a3a3a3")
- self.label1.configure(foreground="#000000")
- self.label1.configure(highlightbackground="#d9d9d9")
- self.label1.configure(highlightcolor="black")
- self.label1.configure(text='''User ID''')
- self.label2 = Label(top)
- self.label2.place(relx=0.222, rely=0.417, height=26, width=68)
- self.label2.configure(activebackground="#f9f9f9")
- self.label2.configure(activeforeground="black")
- self.label2.configure(background="white")
- self.label2.configure(disabledforeground="#a3a3a3")
- self.label2.configure(foreground="#000000")
- self.label2.configure(highlightbackground="#d9d9d9")
- self.label2.configure(highlightcolor="black")
- self.label2.configure(text='''Password''')
- self.btnlogin = Button(top)
- self.btnlogin.place(relx=0.316, rely=0.611, height=33, width=49)
- self.btnlogin.configure(activebackground="#d9d9d9")
- self.btnlogin.configure(activeforeground="#000000")
- self.btnlogin.configure(background="#6AE83A")
- self.btnlogin.configure(disabledforeground="#a3a3a3")
- self.btnlogin.configure(foreground="#000000")
- self.btnlogin.configure(highlightbackground="#d9d9d9")
- self.btnlogin.configure(highlightcolor="black")
- self.btnlogin.configure(pady="0")
- self.btnlogin.configure(text='''Login''')
- self.btnlogin.configure(command=self.save_info)
- self.btnregister = Button(top)
- self.btnregister.place(relx=0.4800, rely=0.800, height=33, width=49)
- self.btnregister.configure(activebackground="#d9d9d9")
- self.btnregister.configure(activeforeground="#000000")
- self.btnregister.configure(background="#57C4B9")
- self.btnregister.configure(disabledforeground="#a3a3a3")
- self.btnregister.configure(foreground="#000000")
- self.btnregister.configure(highlightbackground="#d9d9d9")
- self.btnregister.configure(highlightcolor="black")
- self.btnregister.configure(pady="0")
- self.btnregister.configure(text='''Register''')
- self.btnregister.configure(command=self.register_1);
- self.btncancel = Button(top)
- self.btncancel.place(relx=0.600, rely=0.611, height=33, width=54)
- self.btncancel.configure(activebackground="#d9d9d9")
- self.btncancel.configure(activeforeground="#000000")
- self.btncancel.configure(background="#6AE83A")
- self.btncancel.configure(disabledforeground="#a3a3a3")
- self.btncancel.configure(foreground="#000000")
- self.btncancel.configure(highlightbackground="#d9d9d9")
- self.btncancel.configure(highlightcolor="black")
- self.btncancel.configure(pady="0")
- self.btncancel.configure(text='''Cancel''')
- self.btncancel.configure(command=self.cancelLogin);
- self.txtuser = Text(top)
- self.txtuser.place(relx=0.411, rely=0.222, relheight=0.094
- , relwidth=0.402)
- self.txtuser.configure(background="gray")
- self.txtuser.configure(font="Century 22 bold ")
- self.txtuser.configure(foreground="black")
- self.txtuser.configure(highlightbackground="#d9d9d9")
- self.txtuser.configure(highlightcolor="black")
- self.txtuser.configure(insertbackground="black")
- self.txtuser.configure(selectbackground="#c4c4c4")
- self.txtuser.configure(selectforeground="black")
- self.txtuser.configure(width=254)
- self.txtuser.configure(wrap=WORD)
- password=StringVar()
- self.txtpassword =Entry(root,textvariable=password,show="*")
- self.txtpassword.place(relx=0.411, rely=0.389, relheight=0.094
- , relwidth=0.402)
- self.txtpassword.configure(background="gray")
- self.txtpassword.configure(font="Century 22 bold ")
- self.txtpassword.configure(foreground="black")
- self.txtpassword.configure(highlightbackground="#d9d9d9")
- self.txtpassword.configure(highlightcolor="black")
- self.txtpassword.configure(insertbackground="black")
- self.txtpassword.configure(selectbackground="#c4c4c4")
- self.txtpassword.configure(selectforeground="black")
- self.txtpassword.configure(width=254)
- self.menubar = Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
- top.configure(menu = self.menubar)
Add Comment
Please, Sign In to add comment