Guest User

Untitled

a guest
Nov 29th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. def cancelLogin(self):
  2. msg=messagebox.askyesno("login","Are you Sure?")
  3. if(msg):
  4. exit()
  5.  
  6. def save_info(self):
  7. m=0
  8. **userid_info=self.txtuser.get();
  9. password_info=self.txtpassword.get();**
  10. lines=[]
  11.  
  12. with open ("C:\Users\501446\Downloads\user.txt", 'rt') as in_file:
  13. for line in in_file:
  14. lines.append(line)
  15. if(userid_info==line or password_info==line):
  16. m+=1
  17. if(m==2):
  18. gh=messagebox.showinfo("login","login is succesful")
  19. exit()
  20. else:
  21. gh=messagebox.showinfo("Error","check your password")
  22.  
  23.  
  24. def __init__(self, top=None):
  25. '''This class configures and populates the toplevel window.
  26. top is the toplevel containing window.'''
  27. _bgcolor = '#d9d9d9'
  28. _fgcolor = '#000000'
  29. _compcolor = '#d9d9d9'
  30. _ana1color = '#d9d9d9'
  31. _ana2color = '#d9d9d9'
  32.  
  33. top.geometry("632x360+781+199")
  34. top.title("LOGIN page")
  35. top.configure(background="darkgrey")
  36. top.configure(highlightbackground="#d9d9d9")
  37. top.configure(highlightcolor="black")
  38.  
  39. self.label1 = Label(top)
  40. self.label1.place(relx=0.222, rely=0.25, height=26, width=54)
  41. self.label1.configure(activebackground="#f9f9f9")
  42. self.label1.configure(activeforeground="black")
  43. self.label1.configure(background="white")
  44. self.label1.configure(disabledforeground="#a3a3a3")
  45. self.label1.configure(foreground="#000000")
  46. self.label1.configure(highlightbackground="#d9d9d9")
  47. self.label1.configure(highlightcolor="black")
  48. self.label1.configure(text='''User ID''')
  49.  
  50. self.label2 = Label(top)
  51. self.label2.place(relx=0.222, rely=0.417, height=26, width=68)
  52. self.label2.configure(activebackground="#f9f9f9")
  53. self.label2.configure(activeforeground="black")
  54. self.label2.configure(background="white")
  55. self.label2.configure(disabledforeground="#a3a3a3")
  56. self.label2.configure(foreground="#000000")
  57. self.label2.configure(highlightbackground="#d9d9d9")
  58. self.label2.configure(highlightcolor="black")
  59. self.label2.configure(text='''Password''')
  60.  
  61. self.btnlogin = Button(top)
  62. self.btnlogin.place(relx=0.316, rely=0.611, height=33, width=49)
  63. self.btnlogin.configure(activebackground="#d9d9d9")
  64. self.btnlogin.configure(activeforeground="#000000")
  65. self.btnlogin.configure(background="#6AE83A")
  66. self.btnlogin.configure(disabledforeground="#a3a3a3")
  67. self.btnlogin.configure(foreground="#000000")
  68. self.btnlogin.configure(highlightbackground="#d9d9d9")
  69. self.btnlogin.configure(highlightcolor="black")
  70. self.btnlogin.configure(pady="0")
  71. self.btnlogin.configure(text='''Login''')
  72. self.btnlogin.configure(command=self.save_info)
  73.  
  74. self.btnregister = Button(top)
  75. self.btnregister.place(relx=0.4800, rely=0.800, height=33, width=49)
  76. self.btnregister.configure(activebackground="#d9d9d9")
  77. self.btnregister.configure(activeforeground="#000000")
  78. self.btnregister.configure(background="#57C4B9")
  79. self.btnregister.configure(disabledforeground="#a3a3a3")
  80. self.btnregister.configure(foreground="#000000")
  81. self.btnregister.configure(highlightbackground="#d9d9d9")
  82. self.btnregister.configure(highlightcolor="black")
  83. self.btnregister.configure(pady="0")
  84. self.btnregister.configure(text='''Register''')
  85. self.btnregister.configure(command=self.register_1);
  86.  
  87.  
  88. self.btncancel = Button(top)
  89. self.btncancel.place(relx=0.600, rely=0.611, height=33, width=54)
  90. self.btncancel.configure(activebackground="#d9d9d9")
  91. self.btncancel.configure(activeforeground="#000000")
  92. self.btncancel.configure(background="#6AE83A")
  93. self.btncancel.configure(disabledforeground="#a3a3a3")
  94. self.btncancel.configure(foreground="#000000")
  95. self.btncancel.configure(highlightbackground="#d9d9d9")
  96. self.btncancel.configure(highlightcolor="black")
  97. self.btncancel.configure(pady="0")
  98. self.btncancel.configure(text='''Cancel''')
  99. self.btncancel.configure(command=self.cancelLogin);
  100.  
  101. self.txtuser = Text(top)
  102. self.txtuser.place(relx=0.411, rely=0.222, relheight=0.094
  103. , relwidth=0.402)
  104. self.txtuser.configure(background="gray")
  105. self.txtuser.configure(font="Century 22 bold ")
  106. self.txtuser.configure(foreground="black")
  107. self.txtuser.configure(highlightbackground="#d9d9d9")
  108. self.txtuser.configure(highlightcolor="black")
  109. self.txtuser.configure(insertbackground="black")
  110. self.txtuser.configure(selectbackground="#c4c4c4")
  111. self.txtuser.configure(selectforeground="black")
  112. self.txtuser.configure(width=254)
  113. self.txtuser.configure(wrap=WORD)
  114.  
  115.  
  116. password=StringVar()
  117. self.txtpassword =Entry(root,textvariable=password,show="*")
  118. self.txtpassword.place(relx=0.411, rely=0.389, relheight=0.094
  119. , relwidth=0.402)
  120. self.txtpassword.configure(background="gray")
  121. self.txtpassword.configure(font="Century 22 bold ")
  122. self.txtpassword.configure(foreground="black")
  123. self.txtpassword.configure(highlightbackground="#d9d9d9")
  124. self.txtpassword.configure(highlightcolor="black")
  125. self.txtpassword.configure(insertbackground="black")
  126. self.txtpassword.configure(selectbackground="#c4c4c4")
  127. self.txtpassword.configure(selectforeground="black")
  128. self.txtpassword.configure(width=254)
  129.  
  130.  
  131. self.menubar = Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
  132. top.configure(menu = self.menubar)
Add Comment
Please, Sign In to add comment