Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # GUI module generated by PAGE version 4.16
  5. # In conjunction with Tcl version 8.6
  6. # Sep 20, 2018 03:52:16 PM -0300 platform: Windows NT
  7.  
  8. import sys
  9.  
  10. try:
  11. from Tkinter import *
  12. except ImportError:
  13. from tkinter import *
  14.  
  15. try:
  16. import ttk
  17. py3 = False
  18. except ImportError:
  19. import tkinter.ttk as ttk
  20. py3 = True
  21. import sys
  22. import os
  23. import ttk
  24. import hashlib
  25. import pymysql.cursors
  26.  
  27.  
  28. def vp_start_gui():
  29. '''Starting point when module is the main routine.'''
  30. global val, w, root
  31. root = Tk()
  32. top = Login (root)
  33. login_support.init(root, top)
  34. root.mainloop()
  35.  
  36. w = None
  37. def create_Login(root, *args, **kwargs):
  38. '''Starting point when module is imported by another program.'''
  39. global w, w_win, rt
  40. rt = root
  41. w = Toplevel (root)
  42. top = Login (w)
  43. login_support.init(w, top, *args, **kwargs)
  44. return (w, top)
  45.  
  46. def destroy_Login():
  47. global w
  48. w.destroy()
  49. w = None
  50.  
  51. class Application(Tk):
  52. def __init__(self):
  53. Tk.__init__(self)
  54. self.frame = Login_Screen(self)
  55. self.iconbitmap(os.path.dirname(os.path.abspath(__file__))+"/icon.ico")
  56. self.frame.pack()
  57.  
  58. def change(self, frame):
  59. self.frame.pack_forget()
  60. self.frame = frame(self)
  61. self.frame.pack()
  62.  
  63.  
  64.  
  65. class Login(Frame):
  66. def __init__(self, top=None):
  67. def login():
  68. connection = pymysql.connect(host='us-cdbr-iron-east-01.cleardb.net', user='bef3dd1d2b8b29', password='17702876', db='heroku_d09baa69af15121', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
  69. try:
  70. with connection.cursor() as cursor:
  71. sql = "SELECT `user`, `pass` FROM `Restaurante` WHERE `user`=%s AND `pass`=%s"
  72. cursor.execute(sql, (self.Entry1.get(), self.Senha1.get(),))
  73. result = cursor.fetchone()
  74. if result:
  75. import Restaurante
  76. else:
  77. print("Usuário ou Senha Incorreta!")
  78. except TypeError:
  79. print("Usuário ou Senha Incorreta!")
  80.  
  81. def bt2_click():
  82. print('Login_support.bt2_click')
  83. import Cadastro
  84. sys.stdout.flush()
  85. '''This class configures and populates the toplevel window.
  86. top is the toplevel containing window.'''
  87. _bgcolor = '#d9d9d9' # X11 color: 'gray85'
  88. _fgcolor = '#000000' # X11 color: 'black'
  89. _compcolor = '#d9d9d9' # X11 color: 'gray85'
  90. _ana1color = '#d9d9d9' # X11 color: 'gray85'
  91. _ana2color = '#d9d9d9' # X11 color: 'gray85'
  92. font13 = "-family {Times New Roman} -size 11 -weight bold " \
  93. "-slant italic -underline 0 -overstrike 0"
  94. font22 = "-family SimSun -size 11 -weight bold -slant italic " \
  95. "-underline 0 -overstrike 0"
  96.  
  97. top.geometry("308x244+455+121")
  98. top.title("Login")
  99. top.configure(background="#638F76")
  100.  
  101.  
  102.  
  103. self.Entry1 = Entry(top)
  104. self.Entry1.place(relx=0.36, rely=0.2,height=20, relwidth=0.53)
  105. self.Entry1.configure(background="White")
  106. self.Entry1.configure(disabledforeground="#a3a3a3")
  107. self.Entry1.configure(font="TkFixedFont")
  108. self.Entry1.configure(foreground="#000000")
  109. self.Entry1.configure(insertbackground="black")
  110. self.Entry1.configure(width=164)
  111.  
  112. self.Message1 = Message(top)
  113. self.Message1.place(relx=0.03, rely=0.2, relheight=0.09, relwidth=0.31)
  114. self.Message1.configure(background="white")
  115. self.Message1.configure(font=font13)
  116. self.Message1.configure(foreground="#000000")
  117. self.Message1.configure(highlightbackground="#d9d9d9")
  118. self.Message1.configure(highlightcolor="black")
  119. self.Message1.configure(text='''Usuario:''')
  120. self.Message1.configure(width=94)
  121.  
  122. self.Label1 = Label(top)
  123. self.Label1.place(relx=0.03, rely=0.41, height=21, width=94)
  124. self.Label1.configure(background="white")
  125. self.Label1.configure(disabledforeground="#a3a3a3")
  126. self.Label1.configure(font=font13)
  127. self.Label1.configure(foreground="#000000")
  128. self.Label1.configure(text='''Senha:''')
  129. self.Label1.configure(width=94)
  130.  
  131. self.Entry2 = Entry(top)
  132. self.Entry2.place(relx=0.36, rely=0.41,height=20, relwidth=0.53)
  133. self.Entry2.configure(background="White")
  134. self.Entry2.configure(disabledforeground="#a3a3a3")
  135. self.Entry2.configure(font="TkFixedFont")
  136. self.Entry2.configure(foreground="#000000")
  137. self.Entry2.configure(insertbackground="black")
  138.  
  139. self.Button1 = Button(top)
  140. self.Button1.place(relx=0.23, rely=0.66, height=44, width=167)
  141. self.Button1.configure(activebackground="#d9d9d9")
  142. self.Button1.configure(activeforeground="#000000")
  143. self.Button1.configure(background="#b2b2b2")
  144. self.Button1.configure(command=login_support.login)
  145. self.Button1.configure(disabledforeground="#a3a3a3")
  146. self.Button1.configure(foreground="#000000")
  147. self.Button1.configure(highlightbackground="#d9d9d9")
  148. self.Button1.configure(highlightcolor="black")
  149. self.Button1.configure(pady="0")
  150. self.Button1.configure(text='''Login''')
  151. self.Button1.configure(width=167)
  152.  
  153. self.Label2 = Label(top)
  154. self.Label2.place(relx=0.19, rely=0.04, height=21, width=184)
  155. self.Label2.configure(background="#d9d9d9")
  156. self.Label2.configure(disabledforeground="#a3a3a3")
  157. self.Label2.configure(font=font22)
  158. self.Label2.configure(foreground="black")
  159. self.Label2.configure(text='''Bem Vindo''')
  160. self.Label2.configure(width=184)
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. if __name__ == '__main__':
  168. vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement