Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # GUI module generated by PAGE version 4.16
- # In conjunction with Tcl version 8.6
- # Sep 20, 2018 03:52:16 PM -0300 platform: Windows NT
- import sys
- try:
- from Tkinter import *
- except ImportError:
- from tkinter import *
- try:
- import ttk
- py3 = False
- except ImportError:
- import tkinter.ttk as ttk
- py3 = True
- import sys
- import os
- import ttk
- import hashlib
- import pymysql.cursors
- def vp_start_gui():
- '''Starting point when module is the main routine.'''
- global val, w, root
- root = Tk()
- top = Login (root)
- login_support.init(root, top)
- root.mainloop()
- w = None
- def create_Login(root, *args, **kwargs):
- '''Starting point when module is imported by another program.'''
- global w, w_win, rt
- rt = root
- w = Toplevel (root)
- top = Login (w)
- login_support.init(w, top, *args, **kwargs)
- return (w, top)
- def destroy_Login():
- global w
- w.destroy()
- w = None
- class Application(Tk):
- def __init__(self):
- Tk.__init__(self)
- self.frame = Login_Screen(self)
- self.iconbitmap(os.path.dirname(os.path.abspath(__file__))+"/icon.ico")
- self.frame.pack()
- def change(self, frame):
- self.frame.pack_forget()
- self.frame = frame(self)
- self.frame.pack()
- class Login(Frame):
- def __init__(self, top=None):
- def login():
- connection = pymysql.connect(host='us-cdbr-iron-east-01.cleardb.net', user='bef3dd1d2b8b29', password='17702876', db='heroku_d09baa69af15121', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
- try:
- with connection.cursor() as cursor:
- sql = "SELECT `user`, `pass` FROM `Restaurante` WHERE `user`=%s AND `pass`=%s"
- cursor.execute(sql, (self.Entry1.get(), self.Senha1.get(),))
- result = cursor.fetchone()
- if result:
- import Restaurante
- else:
- print("Usuário ou Senha Incorreta!")
- except TypeError:
- print("Usuário ou Senha Incorreta!")
- def bt2_click():
- print('Login_support.bt2_click')
- import Cadastro
- sys.stdout.flush()
- '''This class configures and populates the toplevel window.
- top is the toplevel containing window.'''
- _bgcolor = '#d9d9d9' # X11 color: 'gray85'
- _fgcolor = '#000000' # X11 color: 'black'
- _compcolor = '#d9d9d9' # X11 color: 'gray85'
- _ana1color = '#d9d9d9' # X11 color: 'gray85'
- _ana2color = '#d9d9d9' # X11 color: 'gray85'
- font13 = "-family {Times New Roman} -size 11 -weight bold " \
- "-slant italic -underline 0 -overstrike 0"
- font22 = "-family SimSun -size 11 -weight bold -slant italic " \
- "-underline 0 -overstrike 0"
- top.geometry("308x244+455+121")
- top.title("Login")
- top.configure(background="#638F76")
- self.Entry1 = Entry(top)
- self.Entry1.place(relx=0.36, rely=0.2,height=20, relwidth=0.53)
- self.Entry1.configure(background="White")
- self.Entry1.configure(disabledforeground="#a3a3a3")
- self.Entry1.configure(font="TkFixedFont")
- self.Entry1.configure(foreground="#000000")
- self.Entry1.configure(insertbackground="black")
- self.Entry1.configure(width=164)
- self.Message1 = Message(top)
- self.Message1.place(relx=0.03, rely=0.2, relheight=0.09, relwidth=0.31)
- self.Message1.configure(background="white")
- self.Message1.configure(font=font13)
- self.Message1.configure(foreground="#000000")
- self.Message1.configure(highlightbackground="#d9d9d9")
- self.Message1.configure(highlightcolor="black")
- self.Message1.configure(text='''Usuario:''')
- self.Message1.configure(width=94)
- self.Label1 = Label(top)
- self.Label1.place(relx=0.03, rely=0.41, height=21, width=94)
- self.Label1.configure(background="white")
- self.Label1.configure(disabledforeground="#a3a3a3")
- self.Label1.configure(font=font13)
- self.Label1.configure(foreground="#000000")
- self.Label1.configure(text='''Senha:''')
- self.Label1.configure(width=94)
- self.Entry2 = Entry(top)
- self.Entry2.place(relx=0.36, rely=0.41,height=20, relwidth=0.53)
- self.Entry2.configure(background="White")
- self.Entry2.configure(disabledforeground="#a3a3a3")
- self.Entry2.configure(font="TkFixedFont")
- self.Entry2.configure(foreground="#000000")
- self.Entry2.configure(insertbackground="black")
- self.Button1 = Button(top)
- self.Button1.place(relx=0.23, rely=0.66, height=44, width=167)
- self.Button1.configure(activebackground="#d9d9d9")
- self.Button1.configure(activeforeground="#000000")
- self.Button1.configure(background="#b2b2b2")
- self.Button1.configure(command=login_support.login)
- self.Button1.configure(disabledforeground="#a3a3a3")
- self.Button1.configure(foreground="#000000")
- self.Button1.configure(highlightbackground="#d9d9d9")
- self.Button1.configure(highlightcolor="black")
- self.Button1.configure(pady="0")
- self.Button1.configure(text='''Login''')
- self.Button1.configure(width=167)
- self.Label2 = Label(top)
- self.Label2.place(relx=0.19, rely=0.04, height=21, width=184)
- self.Label2.configure(background="#d9d9d9")
- self.Label2.configure(disabledforeground="#a3a3a3")
- self.Label2.configure(font=font22)
- self.Label2.configure(foreground="black")
- self.Label2.configure(text='''Bem Vindo''')
- self.Label2.configure(width=184)
- if __name__ == '__main__':
- vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement