Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- import tkSimpleDialog
- import MySQLdb
- import tkMessageBox
- # Janela e botão de sair
- top = Tk()
- top.minsize(width=15, height=10)
- janela = Frame(top)
- janela.pack()
- botao = Button(janela, text="Sair", command=janela.quit)
- botao.pack()
- # Login e Password
- username = tkSimpleDialog.askstring("Login", "Introduza o username: ")
- password = tkSimpleDialog.askstring("Login", "Introduza o password: ", show="*")
- # conexão com o DB
- db = MySQLdb.connect(host="localhost", user="root", password="", db="myhotel")
- cursor = db.cursor()
- cursor.execute("SELECT * FROM login")
- result = cursor.fetchall()
- # Verificar dados
- for record in result:
- if username == record[0] and password == record[1]:
- tkMessageBox.showinfo("Login", "Login correto", janela.mainloop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement